@magicspace/core
Advanced tools
Comparing version 0.2.33 to 0.2.34
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const Path = tslib_1.__importStar(require("path")); | ||
const Path = (0, tslib_1.__importStar)(require("path")); | ||
exports.PACKAGE_DIR = Path.join(__dirname, '../..'); | ||
@@ -8,0 +8,0 @@ exports.TEMP_MAGIC_REPOSITORY_DIR_PREFIX = 'magicspace'; |
@@ -5,14 +5,44 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const ChildProcess = tslib_1.__importStar(require("child_process")); | ||
const Path = tslib_1.__importStar(require("path")); | ||
const FSExtra = tslib_1.__importStar(require("fs-extra")); | ||
const npm_path_1 = tslib_1.__importDefault(require("npm-path")); | ||
const ChildProcess = (0, tslib_1.__importStar)(require("child_process")); | ||
const Path = (0, tslib_1.__importStar)(require("path")); | ||
const FSExtra = (0, tslib_1.__importStar)(require("fs-extra")); | ||
const npm_path_1 = (0, tslib_1.__importDefault)(require("npm-path")); | ||
class SpawnSyncFailure { | ||
constructor(command, args, cwd, stdout, stderr, code) { | ||
this.command = command; | ||
this.args = args; | ||
this.cwd = cwd; | ||
this.stdout = stdout; | ||
this.stderr = stderr; | ||
this.code = code; | ||
Object.defineProperty(this, "command", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: command | ||
}); | ||
Object.defineProperty(this, "args", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: args | ||
}); | ||
Object.defineProperty(this, "cwd", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: cwd | ||
}); | ||
Object.defineProperty(this, "stdout", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: stdout | ||
}); | ||
Object.defineProperty(this, "stderr", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: stderr | ||
}); | ||
Object.defineProperty(this, "code", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: code | ||
}); | ||
} | ||
@@ -74,4 +104,7 @@ } | ||
FSExtra.rmdirSync(from); | ||
return true; | ||
} | ||
return true; | ||
else { | ||
return false; | ||
} | ||
} | ||
@@ -78,0 +111,0 @@ else { |
@@ -5,6 +5,6 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const FS = tslib_1.__importStar(require("fs")); | ||
const Path = tslib_1.__importStar(require("path")); | ||
const FastGlob = tslib_1.__importStar(require("fast-glob")); | ||
const Handlebars = tslib_1.__importStar(require("handlebars")); | ||
const FS = (0, tslib_1.__importStar)(require("fs")); | ||
const Path = (0, tslib_1.__importStar)(require("path")); | ||
const FastGlob = (0, tslib_1.__importStar)(require("fast-glob")); | ||
const Handlebars = (0, tslib_1.__importStar)(require("handlebars")); | ||
const _utils_1 = require("./@utils"); | ||
@@ -129,3 +129,3 @@ function text(...args) { | ||
var _a; | ||
let templatePath = (_a = options.template) !== null && _a !== void 0 ? _a : `${_utils_1.removePathExtension(composableModulePath)}.hbs`; | ||
let templatePath = (_a = options.template) !== null && _a !== void 0 ? _a : `${(0, _utils_1.removePathExtension)(composableModulePath)}.hbs`; | ||
let template = FS.readFileSync(templatePath, 'utf8'); | ||
@@ -132,0 +132,0 @@ return Handlebars.compile(template, { |
@@ -5,6 +5,6 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const FS = tslib_1.__importStar(require("fs")); | ||
const Path = tslib_1.__importStar(require("path")); | ||
const fast_glob_1 = tslib_1.__importDefault(require("fast-glob")); | ||
const lodash_1 = tslib_1.__importDefault(require("lodash")); | ||
const FS = (0, tslib_1.__importStar)(require("fs")); | ||
const Path = (0, tslib_1.__importStar)(require("path")); | ||
const fast_glob_1 = (0, tslib_1.__importDefault)(require("fast-glob")); | ||
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash")); | ||
const module_lens_1 = require("module-lens"); | ||
@@ -40,5 +40,5 @@ const tiva_1 = require("tiva"); | ||
var _a; | ||
let dir = (_a = module_lens_1.resolve(specifier, { | ||
let dir = (_a = (0, module_lens_1.resolve)(specifier, { | ||
sourceFileName: contextFileName, | ||
})) !== null && _a !== void 0 ? _a : module_lens_1.resolve(specifier, { | ||
})) !== null && _a !== void 0 ? _a : (0, module_lens_1.resolve)(specifier, { | ||
sourceFileName: __filename, | ||
@@ -45,0 +45,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./config"), exports); | ||
tslib_1.__exportStar(require("./config-logger"), exports); | ||
(0, tslib_1.__exportStar)(require("./config"), exports); | ||
(0, tslib_1.__exportStar)(require("./config-logger"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,9 +5,29 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const FSExtra = tslib_1.__importStar(require("fs-extra")); | ||
const FSExtra = (0, tslib_1.__importStar)(require("fs-extra")); | ||
class File { | ||
constructor(type, path, context) { | ||
this.type = type; | ||
this.path = path; | ||
this.context = context; | ||
this.composables = []; | ||
Object.defineProperty(this, "type", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: type | ||
}); | ||
Object.defineProperty(this, "path", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: path | ||
}); | ||
Object.defineProperty(this, "context", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: context | ||
}); | ||
Object.defineProperty(this, "composables", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: [] | ||
}); | ||
} | ||
@@ -14,0 +34,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./composable"), exports); | ||
tslib_1.__exportStar(require("./file"), exports); | ||
(0, tslib_1.__exportStar)(require("./composable"), exports); | ||
(0, tslib_1.__exportStar)(require("./file"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,8 @@ "use strict"; | ||
super('binary', path, context); | ||
this.content = Buffer.alloc(0); | ||
Object.defineProperty(this, "content", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: Buffer.alloc(0) | ||
}); | ||
} | ||
@@ -11,0 +16,0 @@ toBuffer() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./json-file"), exports); | ||
tslib_1.__exportStar(require("./structured-file"), exports); | ||
tslib_1.__exportStar(require("./text-file"), exports); | ||
tslib_1.__exportStar(require("./binary-file"), exports); | ||
tslib_1.__exportStar(require("./yaml-file"), exports); | ||
(0, tslib_1.__exportStar)(require("./json-file"), exports); | ||
(0, tslib_1.__exportStar)(require("./structured-file"), exports); | ||
(0, tslib_1.__exportStar)(require("./text-file"), exports); | ||
(0, tslib_1.__exportStar)(require("./binary-file"), exports); | ||
(0, tslib_1.__exportStar)(require("./yaml-file"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -8,2 +8,8 @@ "use strict"; | ||
super('json', path, context); | ||
Object.defineProperty(this, "content", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
@@ -10,0 +16,0 @@ stringify(content) { |
@@ -6,3 +6,3 @@ "use strict"; | ||
const utils_1 = require("@magicspace/utils"); | ||
const lodash_1 = tslib_1.__importDefault(require("lodash")); | ||
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash")); | ||
const file_1 = require("../file"); | ||
@@ -14,3 +14,3 @@ class StructuredFile extends file_1.File { | ||
if (sortKeysOptions && lodash_1.default.isPlainObject(content)) { | ||
content = utils_1.sortObjectKeys(content, sortKeysOptions); | ||
content = (0, utils_1.sortObjectKeys)(content, sortKeysOptions); | ||
} | ||
@@ -17,0 +17,0 @@ return this.stringify(content); |
@@ -8,3 +8,8 @@ "use strict"; | ||
super('text', path, context); | ||
this.content = ''; | ||
Object.defineProperty(this, "content", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: '' | ||
}); | ||
} | ||
@@ -11,0 +16,0 @@ toText() { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const YAML = tslib_1.__importStar(require("yaml")); | ||
const YAML = (0, tslib_1.__importStar)(require("yaml")); | ||
const structured_file_1 = require("./structured-file"); | ||
@@ -11,2 +11,8 @@ class YAMLFile extends structured_file_1.StructuredFile { | ||
super('yaml', path, context); | ||
Object.defineProperty(this, "content", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
} | ||
@@ -13,0 +19,0 @@ stringify(content) { |
@@ -6,7 +6,7 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./file"), exports); | ||
tslib_1.__exportStar(require("./composables"), exports); | ||
tslib_1.__exportStar(require("./config"), exports); | ||
tslib_1.__exportStar(require("./space"), exports); | ||
tslib_1.__exportStar(require("./files"), exports); | ||
(0, tslib_1.__exportStar)(require("./file"), exports); | ||
(0, tslib_1.__exportStar)(require("./composables"), exports); | ||
(0, tslib_1.__exportStar)(require("./config"), exports); | ||
(0, tslib_1.__exportStar)(require("./space"), exports); | ||
(0, tslib_1.__exportStar)(require("./files"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,5 +5,5 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const Path = tslib_1.__importStar(require("path")); | ||
const FSExtra = tslib_1.__importStar(require("fs-extra")); | ||
const lodash_1 = tslib_1.__importDefault(require("lodash")); | ||
const Path = (0, tslib_1.__importStar)(require("path")); | ||
const FSExtra = (0, tslib_1.__importStar)(require("fs-extra")); | ||
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash")); | ||
const _constants_1 = require("../@constants"); | ||
@@ -13,7 +13,17 @@ const _utils_1 = require("../@utils"); | ||
constructor(dir, logger) { | ||
this.dir = dir; | ||
this.logger = logger; | ||
Object.defineProperty(this, "dir", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: dir | ||
}); | ||
Object.defineProperty(this, "logger", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: logger | ||
}); | ||
} | ||
isWorkingDirectoryClean() { | ||
return !_utils_1.spawnSync(this.dir, 'git', ['status', '--porcelain']).trim(); | ||
return !(0, _utils_1.spawnSync)(this.dir, 'git', ['status', '--porcelain']).trim(); | ||
} | ||
@@ -25,3 +35,3 @@ } | ||
try { | ||
return (_utils_1.spawnSync(this.dir, 'git', ['rev-parse', '--git-dir']).trim() === '.git'); | ||
return ((0, _utils_1.spawnSync)(this.dir, 'git', ['rev-parse', '--git-dir']).trim() === '.git'); | ||
} | ||
@@ -34,3 +44,3 @@ catch (_a) { | ||
try { | ||
_utils_1.spawnSync(this.dir, 'git', ['log', '-1']); | ||
(0, _utils_1.spawnSync)(this.dir, 'git', ['log', '-1']); | ||
return false; | ||
@@ -48,3 +58,3 @@ } | ||
var _a; | ||
return (_a = _utils_1.spawnSync(this.dir, 'git', [ | ||
return (_a = (0, _utils_1.spawnSync)(this.dir, 'git', [ | ||
'rev-list', | ||
@@ -60,3 +70,3 @@ '--grep', | ||
try { | ||
_utils_1.spawnSync(this.dir, 'git', ['remote', 'remove', _constants_1.MAGICSPACE_REMOTE]); | ||
(0, _utils_1.spawnSync)(this.dir, 'git', ['remote', 'remove', _constants_1.MAGICSPACE_REMOTE]); | ||
} | ||
@@ -72,3 +82,3 @@ catch (error) { | ||
} | ||
_utils_1.spawnSync(this.dir, 'git', [ | ||
(0, _utils_1.spawnSync)(this.dir, 'git', [ | ||
'remote', | ||
@@ -81,3 +91,3 @@ 'add', | ||
removeMagicspaceRemote() { | ||
_utils_1.spawnSync(this.dir, 'git', ['remote', 'remove', _constants_1.MAGICSPACE_REMOTE]); | ||
(0, _utils_1.spawnSync)(this.dir, 'git', ['remote', 'remove', _constants_1.MAGICSPACE_REMOTE]); | ||
} | ||
@@ -87,3 +97,3 @@ pullMagicspaceChangesWithoutCommit(type, ours = false) { | ||
try { | ||
let stdout = _utils_1.spawnSync(this.dir, 'git', [ | ||
let stdout = (0, _utils_1.spawnSync)(this.dir, 'git', [ | ||
'pull', | ||
@@ -126,3 +136,3 @@ '--no-commit', | ||
let mergeHead = FSExtra.readFileSync(mergeHeadFilePath, 'utf8').trim(); | ||
let diff = _utils_1.spawnSync(this.dir, 'git', [ | ||
let diff = (0, _utils_1.spawnSync)(this.dir, 'git', [ | ||
'show', | ||
@@ -204,3 +214,3 @@ '--diff-filter=R', | ||
FSExtra.removeSync(this.dir); | ||
_utils_1.spawnSync(projectDir, 'git', [ | ||
(0, _utils_1.spawnSync)(projectDir, 'git', [ | ||
'clone', | ||
@@ -214,3 +224,3 @@ '--shared', | ||
checkoutOrphanMagicspaceBranch(commit) { | ||
_utils_1.spawnSync(this.dir, 'git', [ | ||
(0, _utils_1.spawnSync)(this.dir, 'git', [ | ||
'symbolic-ref', | ||
@@ -221,8 +231,8 @@ 'HEAD', | ||
if (commit) { | ||
_utils_1.spawnSync(this.dir, 'git', ['reset', commit]); | ||
(0, _utils_1.spawnSync)(this.dir, 'git', ['reset', commit]); | ||
} | ||
} | ||
addAndCommitChanges(type) { | ||
_utils_1.spawnSync(this.dir, 'git', ['add', '.']); | ||
_utils_1.spawnSync(this.dir, 'git', [ | ||
(0, _utils_1.spawnSync)(this.dir, 'git', ['add', '.']); | ||
(0, _utils_1.spawnSync)(this.dir, 'git', [ | ||
'commit', | ||
@@ -229,0 +239,0 @@ '--message', |
@@ -5,8 +5,23 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const Path = tslib_1.__importStar(require("path")); | ||
const Path = (0, tslib_1.__importStar)(require("path")); | ||
class Context { | ||
constructor(space, dir) { | ||
this.space = space; | ||
this.dir = dir; | ||
this.fileMap = new Map(); | ||
Object.defineProperty(this, "space", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: space | ||
}); | ||
Object.defineProperty(this, "dir", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: dir | ||
}); | ||
Object.defineProperty(this, "fileMap", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: new Map() | ||
}); | ||
} | ||
@@ -13,0 +28,0 @@ getFile(path) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./composable-module"), exports); | ||
tslib_1.__exportStar(require("./context"), exports); | ||
tslib_1.__exportStar(require("./default-space"), exports); | ||
tslib_1.__exportStar(require("./space-logger"), exports); | ||
tslib_1.__exportStar(require("./space"), exports); | ||
(0, tslib_1.__exportStar)(require("./composable-module"), exports); | ||
(0, tslib_1.__exportStar)(require("./context"), exports); | ||
(0, tslib_1.__exportStar)(require("./default-space"), exports); | ||
(0, tslib_1.__exportStar)(require("./space-logger"), exports); | ||
(0, tslib_1.__exportStar)(require("./space"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,4 +5,4 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const Path = tslib_1.__importStar(require("path")); | ||
const tmp_1 = tslib_1.__importDefault(require("tmp")); | ||
const Path = (0, tslib_1.__importStar)(require("path")); | ||
const tmp_1 = (0, tslib_1.__importDefault)(require("tmp")); | ||
const tslib_2 = require("tslib"); | ||
@@ -15,7 +15,32 @@ const _constants_1 = require("../@constants"); | ||
constructor(fileObjectCreatorMap, extensionToFileTypeMap, dir, _config, logger) { | ||
this.fileObjectCreatorMap = fileObjectCreatorMap; | ||
this.extensionToFileTypeMap = extensionToFileTypeMap; | ||
this.dir = dir; | ||
this._config = _config; | ||
this.logger = logger; | ||
Object.defineProperty(this, "fileObjectCreatorMap", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: fileObjectCreatorMap | ||
}); | ||
Object.defineProperty(this, "extensionToFileTypeMap", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: extensionToFileTypeMap | ||
}); | ||
Object.defineProperty(this, "dir", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: dir | ||
}); | ||
Object.defineProperty(this, "_config", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: _config | ||
}); | ||
Object.defineProperty(this, "logger", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: logger | ||
}); | ||
} | ||
@@ -118,3 +143,3 @@ get config() { | ||
for (let { from, to } of renames) { | ||
_utils_1.conservativelyMove(Path.join(this.dir, from), Path.join(this.dir, to)); | ||
(0, _utils_1.conservativelyMove)(Path.join(this.dir, from), Path.join(this.dir, to)); | ||
} | ||
@@ -131,3 +156,3 @@ } | ||
for (let { path: composableModulePath, base: baseDir } of fileEntries) { | ||
let moduleDefault = tslib_2.__importDefault( | ||
let moduleDefault = (0, tslib_2.__importDefault)( | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires | ||
@@ -173,3 +198,3 @@ require(composableModulePath)).default; | ||
}); | ||
let subprocess = await _utils_1.npmRun(script, { | ||
let subprocess = await (0, _utils_1.npmRun)(script, { | ||
pathCWD: Path.dirname(configFilePath), | ||
@@ -176,0 +201,0 @@ cwd, |
{ | ||
"name": "@magicspace/core", | ||
"version": "0.2.33", | ||
"version": "0.2.34", | ||
"publishConfig": { | ||
@@ -19,3 +19,3 @@ "access": "public" | ||
"dependencies": { | ||
"@magicspace/utils": "^0.2.32", | ||
"@magicspace/utils": "^0.2.34", | ||
"fast-glob": "^3.2.4", | ||
@@ -30,3 +30,3 @@ "fs-extra": "^9.0.1", | ||
"tslang": "^0.1.22", | ||
"tslib": "^2.0.3", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.1.3", | ||
@@ -40,3 +40,3 @@ "yaml": "^1.10.0" | ||
}, | ||
"gitHead": "638613b0018a6f86c9c9b4d1c5941cc3a84d61b4" | ||
"gitHead": "6bb9ee397bc93299fa1885eab198970421efebfe" | ||
} |
@@ -92,5 +92,6 @@ import * as ChildProcess from 'child_process'; | ||
FSExtra.rmdirSync(from); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
return true; | ||
} else { | ||
@@ -97,0 +98,0 @@ return false; |
@@ -12,3 +12,3 @@ import {GeneralSortObjectKeysOptions, sortObjectKeys} from '@magicspace/utils'; | ||
TContent, | ||
TOptions extends StructuredFileOptions | ||
TOptions extends StructuredFileOptions, | ||
> extends File<TContent, TOptions> { | ||
@@ -15,0 +15,0 @@ protected abstract stringify(content: TContent): string; |
@@ -249,5 +249,5 @@ import * as Path from 'path'; | ||
return _.uniqBy(renames, ({from, to}) => | ||
JSON.stringify({from, to}), | ||
).filter(rename => FSExtra.existsSync(rename.from)); | ||
return _.uniqBy(renames, ({from, to}) => JSON.stringify({from, to})).filter( | ||
rename => FSExtra.existsSync(rename.from), | ||
); | ||
} | ||
@@ -254,0 +254,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133804
2931
Updated@magicspace/utils@^0.2.34
Updatedtslib@^2.3.1