@sasjs/cli 6.30.0 → 6.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/build/internal/mockSite/assets/api-console.css +365 -0
- package/build/commands/build/internal/mockSite/assets/api-console.js +762 -0
- package/build/commands/build/internal/mockSite/assets/api-index.html +83 -0
- package/build/commands/build/internal/mockSite/assets/boot.js +23 -1
- package/build/commands/build/internal/mockSite/assets/persist.js +76 -5
- package/build/commands/build/internal/mockSite/assets/runtime-core.js +413 -50
- package/build/commands/build/internal/mockSite/assets/sw.js +156 -15
- package/build/commands/build/internal/mockSite/mockSite.d.ts +25 -0
- package/build/commands/build/internal/mockSite/mockSite.js +311 -24
- package/build/commands/build/internal/mockSite/spec/apiConsole.spec.d.ts +1 -0
- package/build/commands/build/internal/mockSite/spec/apiConsole.spec.js +1371 -0
- package/build/commands/build/internal/mockSite/spec/apiConsoleBasePath.spec.d.ts +1 -0
- package/build/commands/build/internal/mockSite/spec/apiConsoleBasePath.spec.js +303 -0
- package/build/commands/build/internal/mockSite/spec/boot.spec.js +50 -3
- package/build/commands/build/internal/mockSite/spec/mockSite.spec.js +217 -3
- package/build/commands/build/internal/mockSite/spec/persist.spec.js +179 -1
- package/build/commands/build/internal/mockSite/spec/runtime-core.spec.js +546 -0
- package/build/commands/build/internal/mockSite/spec/sw.spec.js +407 -53
- package/build/commands/version/spec/version.spec.js +11 -1
- package/build/commands/version/version.d.ts +5 -3
- package/build/commands/version/version.js +17 -7
- package/build/types/mockWebBasePath.d.ts +9 -0
- package/package.json +13 -32
|
@@ -75,6 +75,11 @@ describe('versionMessage', function () {
|
|
|
75
75
|
writePackage(root, '6.4.7-alpha.1');
|
|
76
76
|
expect((0, version_1.versionMessage)(root)).toEqual("You are using a linked version of SASjs CLI (v6.4.7-alpha.1) running from sources at ".concat(root));
|
|
77
77
|
});
|
|
78
|
+
it('leaves the placeholder version out of a source checkout', function () {
|
|
79
|
+
var root = path_1.default.join(tempRoot(), 'cli');
|
|
80
|
+
writePackage(root, '0.0.0');
|
|
81
|
+
expect((0, version_1.versionMessage)(root)).toEqual("You are using a linked version of SASjs CLI running from sources at ".concat(root));
|
|
82
|
+
});
|
|
78
83
|
it('leaves the version out of a source checkout that has none', function () {
|
|
79
84
|
var root = path_1.default.join(tempRoot(), 'cli');
|
|
80
85
|
writePackage(root, undefined);
|
|
@@ -92,6 +97,11 @@ describe('versionMessage', function () {
|
|
|
92
97
|
it('throws when an installed package carries no version', function () {
|
|
93
98
|
var root = packageRoot();
|
|
94
99
|
writePackage(root, undefined);
|
|
95
|
-
expect(function () { return (0, version_1.versionMessage)(root); }).toThrow(/has no version in its package.json
|
|
100
|
+
expect(function () { return (0, version_1.versionMessage)(root); }).toThrow(/has no version in its package.json\./);
|
|
101
|
+
});
|
|
102
|
+
it('names the placeholder when an installed package was never stamped', function () {
|
|
103
|
+
var root = packageRoot();
|
|
104
|
+
writePackage(root, '0.0.0');
|
|
105
|
+
expect(function () { return (0, version_1.versionMessage)(root); }).toThrow(/carries the placeholder version 0\.0\.0, so it was never stamped from a tag/);
|
|
96
106
|
});
|
|
97
107
|
});
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Reads the version from the package.json of the package that is running, so
|
|
5
5
|
* it works for every install shape - global, project-local, `npx`, a temp
|
|
6
6
|
* prefix, or embedded as a dependency. A package root outside a
|
|
7
|
-
* `node_modules` folder is a source checkout (an `npm link`, or a local
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `node_modules` folder is a source checkout (an `npm link`, or a local build),
|
|
8
|
+
* and is reported as such. Its package.json carries the placeholder version
|
|
9
|
+
* (`0.0.0`): the version is the git tag, stamped in when the package is
|
|
10
|
+
* published, so from sources there is nothing to report and the version is left
|
|
11
|
+
* out.
|
|
10
12
|
*
|
|
11
13
|
* @param packageRoot - the folder holding the package.json of the running CLI.
|
|
12
14
|
*/
|
|
@@ -49,9 +49,11 @@ var path_1 = __importDefault(require("path"));
|
|
|
49
49
|
* Reads the version from the package.json of the package that is running, so
|
|
50
50
|
* it works for every install shape - global, project-local, `npx`, a temp
|
|
51
51
|
* prefix, or embedded as a dependency. A package root outside a
|
|
52
|
-
* `node_modules` folder is a source checkout (an `npm link`, or a local
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* `node_modules` folder is a source checkout (an `npm link`, or a local build),
|
|
53
|
+
* and is reported as such. Its package.json carries the placeholder version
|
|
54
|
+
* (`0.0.0`): the version is the git tag, stamped in when the package is
|
|
55
|
+
* published, so from sources there is nothing to report and the version is left
|
|
56
|
+
* out.
|
|
55
57
|
*
|
|
56
58
|
* @param packageRoot - the folder holding the package.json of the running CLI.
|
|
57
59
|
*/
|
|
@@ -65,13 +67,21 @@ var versionMessage = function (packageRoot) {
|
|
|
65
67
|
"Reinstall the CLI - 'npm i -g @sasjs/cli@latest'.");
|
|
66
68
|
}
|
|
67
69
|
var fromSources = !packageRoot.split(path_1.default.sep).includes('node_modules');
|
|
70
|
+
// the placeholder means "not stamped from a tag" - the same thing as absent
|
|
71
|
+
var stated = version && !/^0\.0\.0(-|$)/.test(version) ? version : undefined;
|
|
68
72
|
if (fromSources) {
|
|
69
|
-
return
|
|
70
|
-
? "You are using a linked version of SASjs CLI (v".concat(
|
|
73
|
+
return stated
|
|
74
|
+
? "You are using a linked version of SASjs CLI (v".concat(stated, ") running from sources at ").concat(packageRoot)
|
|
71
75
|
: "You are using a linked version of SASjs CLI running from sources at ".concat(packageRoot);
|
|
72
76
|
}
|
|
73
|
-
if (!
|
|
74
|
-
|
|
77
|
+
if (!stated) {
|
|
78
|
+
// two ways to get here, and they mean different things to whoever is reading
|
|
79
|
+
// it: no version field at all, or the placeholder that was never stamped from
|
|
80
|
+
// a tag
|
|
81
|
+
var reason = version
|
|
82
|
+
? "carries the placeholder version ".concat(version, ", so it was never stamped from a tag")
|
|
83
|
+
: 'has no version in its package.json';
|
|
84
|
+
throw new Error("The installed CLI at ".concat(packageRoot, " ").concat(reason, ". ") +
|
|
75
85
|
"Reinstall it - 'npm i -g @sasjs/cli@latest'.");
|
|
76
86
|
}
|
|
77
87
|
return "You are using SASjs CLI v".concat(version);
|
|
@@ -20,5 +20,14 @@ declare module '@sasjs/utils/types/config' {
|
|
|
20
20
|
* slash (`/demo`). Unset means the origin root.
|
|
21
21
|
*/
|
|
22
22
|
mockWebBasePath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the mock site carries the API console at `<base>/api/`.
|
|
25
|
+
*
|
|
26
|
+
* On unless it is set to false: the console is how a demonstration site lets
|
|
27
|
+
* a visitor try the API it is a mock of, and a page nothing links to costs
|
|
28
|
+
* the app nothing. A site whose output must be the app and nothing else
|
|
29
|
+
* turns it off.
|
|
30
|
+
*/
|
|
31
|
+
mockApi?: boolean;
|
|
23
32
|
}
|
|
24
33
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sasjs/cli",
|
|
3
|
+
"version": "6.31.0",
|
|
3
4
|
"description": "Command line interface for SASjs",
|
|
4
5
|
"engines": {
|
|
5
6
|
"node": "^22.14.0 || >=24.10.0"
|
|
@@ -9,43 +10,23 @@
|
|
|
9
10
|
"build/**/*"
|
|
10
11
|
],
|
|
11
12
|
"scripts": {
|
|
12
|
-
"start:ci": "npm run build && npm run set:permissions",
|
|
13
|
-
"start": "nodemon --watch \"src/**/*\" --exec \"npm run build && npm run set:permissions\"",
|
|
14
|
-
"set:permissions": "node -e \"require('fs').chmodSync('build/index.js', '755')\"",
|
|
15
13
|
"build": "npx rimraf build && tsc -p . && npm run copy:files",
|
|
16
|
-
"copy:files": "copyfiles -u 1 ./src/config.json ./build/ && npm run copy:doxy && npm run copy:mock",
|
|
17
14
|
"copy:doxy": "copyfiles -u 2 src/doxy/* build/doxy/",
|
|
15
|
+
"copy:files": "copyfiles -u 1 ./src/config.json ./build/ && npm run copy:doxy && npm run copy:mock",
|
|
18
16
|
"copy:mock": "copyfiles -u 6 src/commands/build/internal/mockSite/assets/* build/commands/build/internal/mockSite/assets/",
|
|
17
|
+
"doc": "npx compodoc -p tsconfig.doc.json --coverageTest 16 --coverageTestThresholdFail",
|
|
18
|
+
"lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
|
19
|
+
"lint:fix": "npx prettier --write \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
|
20
|
+
"prepublishOnly": "node -e \"const v=require('./package.json').version; if (/^0\\.0\\.0/.test(v)) { console.error('refusing to publish ' + v + ': the version is stamped from the tag (npm version <tag> --no-git-tag-version)'); process.exit(1) }\"",
|
|
21
|
+
"release": "sasjs-release",
|
|
22
|
+
"set:permissions": "node -e \"require('fs').chmodSync('build/index.js', '755')\"",
|
|
23
|
+
"start": "nodemon --watch \"src/**/*\" --exec \"npm run build && npm run set:permissions\"",
|
|
24
|
+
"start:ci": "npm run build && npm run set:permissions",
|
|
19
25
|
"test": "npm run test:mocked && npm run test:server",
|
|
20
|
-
"test:server": "jest --silent --runInBand --config=jest.server.config.js",
|
|
21
26
|
"test:mocked": "jest --silent --runInBand --config=jest.config.js --coverage",
|
|
22
|
-
"
|
|
23
|
-
"lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
|
24
|
-
"doc": "npx compodoc -p tsconfig.doc.json --coverageTest 16 --coverageTestThresholdFail"
|
|
27
|
+
"test:server": "jest --silent --runInBand --config=jest.server.config.js"
|
|
25
28
|
},
|
|
26
29
|
"testServerTypes": "sasjs",
|
|
27
|
-
"release": {
|
|
28
|
-
"branches": [
|
|
29
|
-
"main"
|
|
30
|
-
],
|
|
31
|
-
"plugins": [
|
|
32
|
-
"@semantic-release/commit-analyzer",
|
|
33
|
-
"@semantic-release/release-notes-generator",
|
|
34
|
-
[
|
|
35
|
-
"@semantic-release/npm",
|
|
36
|
-
{
|
|
37
|
-
"npmPublish": false
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
"@semantic-release/exec",
|
|
42
|
-
{
|
|
43
|
-
"publishCmd": "npm publish --provenance --access public"
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
"@semantic-release/github"
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
30
|
"bin": {
|
|
50
31
|
"sasjs": "build/index.js"
|
|
51
32
|
},
|
|
@@ -97,6 +78,7 @@
|
|
|
97
78
|
"@babel/preset-env": "7.29.7",
|
|
98
79
|
"@babel/preset-typescript": "7.29.7",
|
|
99
80
|
"@nogoo9/gitleaks": "8.30.1-post.2",
|
|
81
|
+
"@sasjs/release": "0.1.3",
|
|
100
82
|
"@types/debug": "4.1.13",
|
|
101
83
|
"@types/find": "0.2.4",
|
|
102
84
|
"@types/jest": "30.0.0",
|
|
@@ -124,6 +106,5 @@
|
|
|
124
106
|
"overrides": {
|
|
125
107
|
"ws": "8.21.0",
|
|
126
108
|
"nanoid": "3.3.18"
|
|
127
|
-
}
|
|
128
|
-
"version": "6.30.0"
|
|
109
|
+
}
|
|
129
110
|
}
|