Stabel

Check-in [9f5b523bee]
Login
Overview
Comment:Changed references from play to stabel in cli program and standard library.
Timelines: family | ancestors | descendants | both | rebranding
Files: files | file ages | folders
SHA3-256: 9f5b523bee7704da31f6b4e4a762e412e006bb9cbb8d0e93567fff0aaeae077e
User & Date: robin.hansen on 2021-06-03 08:56:52
Other Links: branch diff | manifest | tags
Context
2021-06-03
09:00
Updated PackageLoader with new filename extension and name of .json metadata file. check-in: 39d1781e1d user: robin.hansen tags: rebranding
08:56
Changed references from play to stabel in cli program and standard library. check-in: 9f5b523bee user: robin.hansen tags: rebranding
08:49
play => stabel in package.json check-in: e5a449cdec user: robin.hansen tags: rebranding
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified bin/cli.js from [30c9406240] to [15abce7081].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
    if (subCmdFlags.length !== 1) {
        console.error("'init' requires exactly one argument: the package name.");
        return;
    }

    fs.mkdirSync(path.join(cwd, "src"));

    const playJson = {
        name: subCmdFlags[0],
        version: "0.1.0",
        "language-version": "0.2.0",
        "exposed-modules": [
            "main"
        ],
        dependencies: {
            "play/standard_library": "0.2.0"
        },
        "package-paths": []
    };

    fs.writeFileSync(path.join(cwd, "play.json"), JSON.stringify(playJson, null, 4));

    fs.writeFileSync(path.join(cwd, "src", "main.play"), `
def: execute
: 0
`.trim());
}

function runProject() {
    if (subCmdFlags.length !== 1) {
................................................................................
        return;
    }

    compileProject(subCmdFlags[0]);
}

function compileProject(entryPoint) {
    const rootJsonMetaPath = path.join(cwd, "play.json");
    if (!fs.existsSync(rootJsonMetaPath)) {
        console.error("No 'play.json' file found in this directory.");
        return;
    }

    const compiler = require(__dirname + "/compiler").Elm.CLI.init({
        flags: {
            projectDir: cwd,
            entryPoint: typeof entryPoint === "undefined" ? null : entryPoint,
................................................................................
                    fileName: msg.fileName,
                    content: fileContent
                });
                break;
            case "resolvePackageModules":
                const srcPath = path.join(msg.path, "src");
                const childrenFiles = expandDir(msg.path)("src")
                    .filter(name => name.endsWith(".play"))
                    .map(name => name.replace(srcPath + "/", ""));

                compiler.ports.incomingPort.send({
                    type: "resolvedPackageModules",
                    package: msg.package,
                    modules: childrenFiles
                });
................................................................................
    };
}

function packageDirs(parentDir) {
    return fs.readdirSync(parentDir)
        .map(dir => path.join(parentDir, dir))
        .filter(dir => fs.statSync(dir).isDirectory())
        .filter(dir => fs.readdirSync(dir).indexOf('play.json') >= 0);
}

function printHelp() {
    console.log(`
Play compiler. Alpha-2.

Possible options are:
* init <package_name>: initialize a new project in the current directory.
* compile: compile the project.
* run <function_name>: compile the project and execute the given function.
* help: print this help message.
    `);







|







|




|

|







 







|

|







 







|







 







|




|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
    if (subCmdFlags.length !== 1) {
        console.error("'init' requires exactly one argument: the package name.");
        return;
    }

    fs.mkdirSync(path.join(cwd, "src"));

    const stabelJson = {
        name: subCmdFlags[0],
        version: "0.1.0",
        "language-version": "0.2.0",
        "exposed-modules": [
            "main"
        ],
        dependencies: {
            "stabel/standard_library": "0.2.0"
        },
        "package-paths": []
    };

    fs.writeFileSync(path.join(cwd, "stabel.json"), JSON.stringify(stabelJson, null, 4));

    fs.writeFileSync(path.join(cwd, "src", "main.stbl"), `
def: execute
: 0
`.trim());
}

function runProject() {
    if (subCmdFlags.length !== 1) {
................................................................................
        return;
    }

    compileProject(subCmdFlags[0]);
}

function compileProject(entryPoint) {
    const rootJsonMetaPath = path.join(cwd, "stabel.json");
    if (!fs.existsSync(rootJsonMetaPath)) {
        console.error("No 'stabel.json' file found in this directory.");
        return;
    }

    const compiler = require(__dirname + "/compiler").Elm.CLI.init({
        flags: {
            projectDir: cwd,
            entryPoint: typeof entryPoint === "undefined" ? null : entryPoint,
................................................................................
                    fileName: msg.fileName,
                    content: fileContent
                });
                break;
            case "resolvePackageModules":
                const srcPath = path.join(msg.path, "src");
                const childrenFiles = expandDir(msg.path)("src")
                    .filter(name => name.endsWith(".stbl"))
                    .map(name => name.replace(srcPath + "/", ""));

                compiler.ports.incomingPort.send({
                    type: "resolvedPackageModules",
                    package: msg.package,
                    modules: childrenFiles
                });
................................................................................
    };
}

function packageDirs(parentDir) {
    return fs.readdirSync(parentDir)
        .map(dir => path.join(parentDir, dir))
        .filter(dir => fs.statSync(dir).isDirectory())
        .filter(dir => fs.readdirSync(dir).indexOf('stabel.json') >= 0);
}

function printHelp() {
    console.log(`
Stabel v0.2.0-alpha

Possible options are:
* init <package_name>: initialize a new project in the current directory.
* compile: compile the project.
* run <function_name>: compile the project and execute the given function.
* help: print this help message.
    `);

Modified package-lock.json from [473bdddb66] to [313b7a3fa5].

1
2
3
4
5
6
7
8
9
10
{
  "name": "play",
  "version": "0.0.1",
  "lockfileVersion": 1,
  "requires": true,
  "dependencies": {
    "@babel/code-frame": {
      "version": "7.12.13",
      "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz",
      "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==",

|
|







1
2
3
4
5
6
7
8
9
10
{
  "name": "stabel",
  "version": "0.2.0",
  "lockfileVersion": 1,
  "requires": true,
  "dependencies": {
    "@babel/code-frame": {
      "version": "7.12.13",
      "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz",
      "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==",

Name change from stdlib/src/core.play to stdlib/src/core.stbl.

Name change from stdlib/src/list.play to stdlib/src/list.stbl.

Name change from stdlib/src/maybe.play to stdlib/src/maybe.stbl.

Name change from stdlib/src/pair.play to stdlib/src/pair.stbl.

Modified stdlib/stabel.json from [f2261f0ba9] to [89a8117702].

1
2
3
4
5
6
7
8
9
10
11
12
13
{
    "name": "play/standard_library",
    "version": "0.2.0",
    "language-version": "0.2.0",
    "exposed-modules": [
        "core",
        "maybe",
        "pair",
        "list"
    ],
    "dependencies": {},
    "package-paths": []
}

|











1
2
3
4
5
6
7
8
9
10
11
12
13
{
    "name": "stabel/standard_library",
    "version": "0.2.0",
    "language-version": "0.2.0",
    "exposed-modules": [
        "core",
        "maybe",
        "pair",
        "list"
    ],
    "dependencies": {},
    "package-paths": []
}