@sasjs/cli 6.28.0 → 6.29.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.
@@ -7,7 +7,6 @@ exports.angularAppFiles = {
7
7
  { fileName: 'package.json' },
8
8
  { fileName: 'package-lock.json' },
9
9
  { fileName: 'tsconfig.json' },
10
- { fileName: 'tslint.json' },
11
10
  { fileName: 'angular.json' },
12
11
  { fileName: 'tsconfig.app.json' },
13
12
  { fileName: 'README.md' }
@@ -50,7 +49,6 @@ exports.angularAppFiles = {
50
49
  files: [
51
50
  { fileName: 'app.component.html' },
52
51
  { fileName: 'app.component.scss' },
53
- { fileName: 'app.component.spec.ts' },
54
52
  { fileName: 'app.component.ts' },
55
53
  { fileName: 'app.module.ts' },
56
54
  { fileName: 'app-routing.module.ts' },
@@ -64,7 +62,6 @@ exports.angularAppFiles = {
64
62
  folderName: 'sasjs-ui',
65
63
  files: [
66
64
  { fileName: 'sasjs-ui.component.html' },
67
- { fileName: 'sasjs-ui.component.spec.ts' },
68
65
  { fileName: 'sasjs-ui.component.scss' },
69
66
  { fileName: 'sasjs-ui.component.ts' }
70
67
  ],
@@ -75,7 +72,6 @@ exports.angularAppFiles = {
75
72
  files: [
76
73
  { fileName: 'data.component.html' },
77
74
  { fileName: 'data.component.scss' },
78
- { fileName: 'data.component.spec.ts' },
79
75
  { fileName: 'data.component.ts' }
80
76
  ],
81
77
  subFolders: []
@@ -85,7 +81,6 @@ exports.angularAppFiles = {
85
81
  files: [
86
82
  { fileName: 'home-page.component.html' },
87
83
  { fileName: 'home-page.component.scss' },
88
- { fileName: 'home-page.component.spec.ts' },
89
84
  { fileName: 'home-page.component.ts' }
90
85
  ],
91
86
  subFolders: []
@@ -111,8 +106,11 @@ exports.angularAppFiles = {
111
106
  ]
112
107
  },
113
108
  {
109
+ // The docs folder is a submodule, and its pages are the submodule's own
110
+ // (a docsify site today, an index.html before that). The folder is what
111
+ // this asserts; naming a page here breaks on the submodule's next change.
114
112
  folderName: 'docs',
115
- files: [{ fileName: 'index.html' }],
113
+ files: [],
116
114
  subFolders: []
117
115
  }
118
116
  ]
@@ -115,7 +115,7 @@ describe('sasjs cbd with server type SASJS', function () {
115
115
  });
116
116
  }); });
117
117
  it("should deploy compile and build to sasjs/server", function () { return __awaiter(void 0, void 0, void 0, function () {
118
- var deployMock, _a, customTarget, macroCorePath, mf_getuser, _b, mp_jsonout, ms_webout, webout, mocksPath, appinitJSPath, getdataJSPath, appinitJSContents, getdataJSContents, depsInserts, appinit, getdata, getCode;
118
+ var deployMock, _a, customTarget, macroCorePath, mf_getuser, _b, mp_jsonout, ms_webout, webout, mocksPath, appinitJSPath, getdataJSPath, springsJSONPath, appinitJSContents, getdataJSContents, springsJSONContents, depsInserts, appinit, getdata, getCode;
119
119
  return __generator(this, function (_c) {
120
120
  switch (_c.label) {
121
121
  case 0:
@@ -183,12 +183,16 @@ describe('sasjs cbd with server type SASJS', function () {
183
183
  mocksPath = path_1.default.join(__dirname, appName, 'sasjs', 'mocks');
184
184
  appinitJSPath = path_1.default.join(mocksPath, 'services', 'common', 'appinit.js');
185
185
  getdataJSPath = path_1.default.join(mocksPath, 'services', 'common', 'getdata.js');
186
+ springsJSONPath = path_1.default.join(mocksPath, 'services', 'common', 'springs.json');
186
187
  return [4 /*yield*/, (0, utils_1.readFile)(appinitJSPath)];
187
188
  case 11:
188
189
  appinitJSContents = _c.sent();
189
190
  return [4 /*yield*/, (0, utils_1.readFile)(getdataJSPath)];
190
191
  case 12:
191
192
  getdataJSContents = _c.sent();
193
+ return [4 /*yield*/, (0, utils_1.readFile)(springsJSONPath)];
194
+ case 13:
195
+ springsJSONContents = _c.sent();
192
196
  depsInserts = "\n\n* Service Variables start;\n\n\n* Service Variables end;\n* SAS Macros start;\n\n\n\n* SAS Macros end;\n* SAS Includes start;\n\n* SAS Includes end;\n* Binary Files start;\n\n* Binary Files end;\n\n\n* Service start;\n";
193
197
  appinit = "/**\n @file appinit.sas\n @brief Initialisation service - runs on app startup\n @details This is always the first service called when the app is opened.\n\n <h4> SAS Macros </h4>\n\n**/\n\nproc sql;\ncreate table areas as select distinct area\n from mydb.springs;\n\n%webout(OPEN)\n%webout(OBJ,areas)\n%webout(CLOSE)\n\n";
194
198
  getdata = "/**\n @file getdata.sas\n @brief Get Data service - runs on app startup\n @details This is always the first service called when the app is opened.\n\n <h4> SAS Macros </h4>\n\n**/\n\n%webout(FETCH)\n\nproc sql;\ncreate table springs as select * from mydb.springs\n where area in (select area from work.areas);\n\n%webout(OPEN)\n%webout(OBJ,springs)\n%webout(CLOSE)\n\n";
@@ -228,6 +232,12 @@ describe('sasjs cbd with server type SASJS', function () {
228
232
  name: 'getdata',
229
233
  type: 'service',
230
234
  code: getCode((0, utils_1.removeHeader)(getdata))
235
+ },
236
+ {
237
+ name: 'springs.json',
238
+ type: 'file',
239
+ encoding: 'base64',
240
+ code: (0, js_base64_1.encode)(springsJSONContents)
231
241
  }
232
242
  ]
233
243
  }
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -43,18 +54,29 @@ exports.createLintConfigFile = void 0;
43
54
  var path_1 = __importDefault(require("path"));
44
55
  var lint_1 = require("@sasjs/lint");
45
56
  var utils_1 = require("@sasjs/utils");
57
+ /**
58
+ * Where the settings of a `.sasjslint` are documented.
59
+ *
60
+ * The file is read as strict JSON, so it cannot carry comments - the same
61
+ * problem `sasjsconfig.json` answers with `$schema`, and the same address
62
+ * pattern (`sasjs init` writes https://cli.sasjs.io/sasjsconfig-schema.json).
63
+ * An editor that understands JSON schemas then completes the settings and
64
+ * shows each one's description as it is typed.
65
+ */
66
+ var lintSchemaUrl = 'https://cli.sasjs.io/sasjslint-schema.json';
46
67
  /**
47
68
  * Creates a SASjs Lint configuration file.
48
69
  * Its name will be of the form '.sasjslint'
49
70
  * @param {string} parentFolderName- the name of the project folder.
50
71
  */
51
72
  var createLintConfigFile = function (parentFolderName) { return __awaiter(void 0, void 0, void 0, function () {
52
- var configDestinationPath;
73
+ var configDestinationPath, config;
53
74
  return __generator(this, function (_a) {
54
75
  switch (_a.label) {
55
76
  case 0:
56
77
  configDestinationPath = path_1.default.join(process.projectDir, parentFolderName, '.sasjslint');
57
- return [4 /*yield*/, (0, utils_1.createFile)(configDestinationPath, JSON.stringify(lint_1.DefaultLintConfiguration, null, 2))];
78
+ config = __assign({ $schema: lintSchemaUrl }, lint_1.DefaultLintConfiguration);
79
+ return [4 /*yield*/, (0, utils_1.createFile)(configDestinationPath, JSON.stringify(config, null, 2))];
58
80
  case 1:
59
81
  _a.sent();
60
82
  return [2 /*return*/];
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __generator = (this && this.__generator) || function (thisArg, body) {
45
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
47
+ function verb(n) { return function (v) { return step([n, v]); }; }
48
+ function step(op) {
49
+ if (f) throw new TypeError("Generator is already executing.");
50
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
51
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
52
+ if (y = 0, t) op = [op[0] & 2, t.value];
53
+ switch (op[0]) {
54
+ case 0: case 1: t = op; break;
55
+ case 4: _.label++; return { value: op[1], done: false };
56
+ case 5: _.label++; y = op[1]; op = [0]; continue;
57
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
58
+ default:
59
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
60
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
61
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
62
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
63
+ if (t[2]) _.ops.pop();
64
+ _.trys.pop(); continue;
65
+ }
66
+ op = body.call(thisArg, _);
67
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
68
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
69
+ }
70
+ };
71
+ var __rest = (this && this.__rest) || function (s, e) {
72
+ var t = {};
73
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
74
+ t[p] = s[p];
75
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
76
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
77
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
78
+ t[p[i]] = s[p[i]];
79
+ }
80
+ return t;
81
+ };
82
+ Object.defineProperty(exports, "__esModule", { value: true });
83
+ var promises_1 = require("fs/promises");
84
+ var os = __importStar(require("os"));
85
+ var path = __importStar(require("path"));
86
+ var lint_1 = require("@sasjs/lint");
87
+ var utils_1 = require("@sasjs/utils");
88
+ var createLintConfigFile_1 = require("../createLintConfigFile");
89
+ /**
90
+ * The file this writes is the first thing a new project has to edit, and the
91
+ * only place its settings are described: it is read as strict JSON, so it cannot
92
+ * carry comments, and `$schema` is what gives an editor the description of each
93
+ * setting where it is written.
94
+ */
95
+ describe('createLintConfigFile', function () {
96
+ var originalProjectDir = process.projectDir;
97
+ var projectDir;
98
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
99
+ return __generator(this, function (_a) {
100
+ switch (_a.label) {
101
+ case 0:
102
+ projectDir = path.join(os.tmpdir(), "sasjs-lint-config-".concat(Date.now(), "-").concat(Math.random().toString(36).slice(2)));
103
+ return [4 /*yield*/, (0, utils_1.createFolder)(projectDir)];
104
+ case 1:
105
+ _a.sent();
106
+ process.projectDir = projectDir;
107
+ return [2 /*return*/];
108
+ }
109
+ });
110
+ }); });
111
+ afterEach(function () {
112
+ process.projectDir = originalProjectDir;
113
+ });
114
+ it('writes every default setting, with the schema', function () { return __awaiter(void 0, void 0, void 0, function () {
115
+ var written, _a, _b, _schema, settings;
116
+ return __generator(this, function (_c) {
117
+ switch (_c.label) {
118
+ case 0: return [4 /*yield*/, (0, createLintConfigFile_1.createLintConfigFile)('.')];
119
+ case 1:
120
+ _c.sent();
121
+ _b = (_a = JSON).parse;
122
+ return [4 /*yield*/, (0, promises_1.readFile)(path.join(projectDir, '.sasjslint'), 'utf-8')];
123
+ case 2:
124
+ written = _b.apply(_a, [_c.sent()]);
125
+ expect(written.$schema).toEqual('https://cli.sasjs.io/sasjslint-schema.json');
126
+ _schema = written.$schema, settings = __rest(written, ["$schema"]);
127
+ expect(settings).toEqual(lint_1.DefaultLintConfiguration);
128
+ return [2 /*return*/];
129
+ }
130
+ });
131
+ }); });
132
+ });
@@ -585,9 +585,11 @@ var verifyPackageJsonContent = function () {
585
585
  case 2:
586
586
  packageJsonContent = _a.sent();
587
587
  packageJson = JSON.parse(packageJsonContent);
588
- expect(parentFolderName.includes('minimal')
589
- ? packageJson.devDependencies
590
- : packageJson.dependencies).toEqual(expect.objectContaining({ '@sasjs/core': expect.anything() }));
588
+ // Which map the seed app declares its SASjs dependency in is the seed's
589
+ // business - a web app carries @sasjs/core as a devDependency (it compiles
590
+ // the macros in) while the jobs template installs it as a dependency. What
591
+ // this asserts is that the template brings the macros with it at all.
592
+ expect(__assign(__assign({}, packageJson.devDependencies), packageJson.dependencies)).toEqual(expect.objectContaining({ '@sasjs/core': expect.anything() }));
591
593
  return [2 /*return*/];
592
594
  }
593
595
  });
package/package.json CHANGED
@@ -125,5 +125,5 @@
125
125
  "ws": "8.21.0",
126
126
  "nanoid": "3.3.18"
127
127
  },
128
- "version": "6.28.0"
128
+ "version": "6.29.0"
129
129
  }