diff --git a/.gitignore b/.gitignore index 89dff23..42f8ebb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ coverage/ -docs/ \ No newline at end of file +docs/ +config.json \ No newline at end of file diff --git a/dist/npmci.env.d.ts b/dist/npmci.env.d.ts index ac48b1b..193aa4d 100644 --- a/dist/npmci.env.d.ts +++ b/dist/npmci.env.d.ts @@ -6,3 +6,6 @@ export declare let buildStage: string; export declare let dockerRegistry: any; export declare let dockerFilesBuilt: Dockerfile[]; export declare let dockerFiles: Dockerfile[]; +export declare let config: any; +export declare let configLoad: () => void; +export declare let configStore: () => void; diff --git a/dist/npmci.env.js b/dist/npmci.env.js index 29146d4..8d50763 100644 --- a/dist/npmci.env.js +++ b/dist/npmci.env.js @@ -1,9 +1,18 @@ "use strict"; require("typings-global"); +var plugins = require("./npmci.plugins"); +var paths = require("./npmci.paths"); var smartstring_1 = require("smartstring"); exports.repo = new smartstring_1.GitRepo(process.env.CI_BUILD_REPO); exports.buildStage = process.env.CI_BUILD_STAGE; exports.dockerFilesBuilt = []; exports.dockerFiles = []; +exports.configLoad = function () { + exports.config = plugins.smartfile.local.toObjectSync(paths.NpmciPackageConfig, "json"); + exports.config.dockerRegistry ? exports.dockerRegistry = exports.config.dockerRegistry : void (0); + exports.config.dockerFilesBuilt ? exports.dockerFilesBuilt = exports.config.dockerFilesBuilt : void (0); +}; +exports.configStore = function () { +}; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLDRCQUFzQixhQUFhLENBQUMsQ0FBQTtBQUd6QixZQUFJLEdBQVcsSUFBSSxxQkFBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFdEQsa0JBQVUsR0FBVSx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1aWxkLmRvY2tlclwiXHJcblxyXG5leHBvcnQgbGV0IHJlcG86R2l0UmVwbyA9IG5ldyBHaXRSZXBvKHByb2Nlc3MuZW52LkNJX0JVSUxEX1JFUE8pO1xyXG5cclxuZXhwb3J0IGxldCBidWlsZFN0YWdlOnN0cmluZyA9IHByb2Nlc3MuZW52LkNJX0JVSUxEX1NUQUdFO1xyXG5cclxuLy8gaGFuZGxpbmcgY29uZmlnIGJldHdlZW4gY29tbWFuZHNcclxuZXhwb3J0IGxldCBkb2NrZXJSZWdpc3RyeTsgLy8gd2lsbCBiZSBzZXQgYnkgbnBtY2kucHJlcGFyZVxyXG5leHBvcnQgbGV0IGRvY2tlckZpbGVzQnVpbHQ6RG9ja2VyZmlsZVtdID0gW107XHJcbmV4cG9ydCBsZXQgZG9ja2VyRmlsZXM6RG9ja2VyZmlsZVtdID0gW107XHJcblxyXG5leHBvcnQgbGV0IGNvbmZpZztcclxuXHJcbmV4cG9ydCBsZXQgY29uZmlnTG9hZCA9ICgpID0+IHtcclxuICAgIGNvbmZpZyA9IHBsdWdpbnMuc21hcnRmaWxlLmxvY2FsLnRvT2JqZWN0U3luYyhwYXRocy5OcG1jaVBhY2thZ2VDb25maWcsXCJqc29uXCIpO1xyXG4gICAgY29uZmlnLmRvY2tlclJlZ2lzdHJ5ID8gZG9ja2VyUmVnaXN0cnkgPSBjb25maWcuZG9ja2VyUmVnaXN0cnkgOiB2b2lkKDApO1xyXG4gICAgY29uZmlnLmRvY2tlckZpbGVzQnVpbHQgPyBkb2NrZXJGaWxlc0J1aWx0ID0gY29uZmlnLmRvY2tlckZpbGVzQnVpbHQgOiB2b2lkKDApO1xyXG59XHJcblxyXG5leHBvcnQgbGV0IGNvbmZpZ1N0b3JlID0gKCkgPT4ge1xyXG4gICAgXHJcbn0iXX0= diff --git a/dist/npmci.paths.d.ts b/dist/npmci.paths.d.ts new file mode 100644 index 0000000..ac7cd71 --- /dev/null +++ b/dist/npmci.paths.d.ts @@ -0,0 +1,4 @@ +import "typings-global"; +export declare let cwd: string; +export declare let NpmciPackageRoot: string; +export declare let NpmciPackageConfig: string; diff --git a/dist/npmci.paths.js b/dist/npmci.paths.js new file mode 100644 index 0000000..f206d05 --- /dev/null +++ b/dist/npmci.paths.js @@ -0,0 +1,8 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmci.plugins"); +exports.cwd = process.cwd(); +exports.NpmciPackageRoot = plugins.path.join(__dirname, "../"); +exports.NpmciPackageConfig = plugins.path.join(exports.NpmciPackageRoot, "./config.json"); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnBhdGhzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBWSxPQUFPLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUVoQyxXQUFHLEdBQUcsT0FBTyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRXBCLHdCQUFnQixHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBQyxLQUFLLENBQUMsQ0FBQztBQUN0RCwwQkFBa0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyx3QkFBZ0IsRUFBQyxlQUFlLENBQUMsQ0FBQSIsImZpbGUiOiJucG1jaS5wYXRocy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XHJcbmltcG9ydCAqIGFzIHBsdWdpbnMgZnJvbSBcIi4vbnBtY2kucGx1Z2luc1wiO1xyXG5cclxuZXhwb3J0IGxldCBjd2QgPSBwcm9jZXNzLmN3ZCgpO1xyXG5cclxuZXhwb3J0IGxldCBOcG1jaVBhY2thZ2VSb290ID0gcGx1Z2lucy5wYXRoLmpvaW4oX19kaXJuYW1lLFwiLi4vXCIpOyNcclxuZXhwb3J0IGxldCBOcG1jaVBhY2thZ2VDb25maWcgPSBwbHVnaW5zLnBhdGguam9pbihOcG1jaVBhY2thZ2VSb290LFwiLi9jb25maWcuanNvblwiKSJdfQ== diff --git a/ts/npmci.env.ts b/ts/npmci.env.ts index 3fad261..30eb36b 100644 --- a/ts/npmci.env.ts +++ b/ts/npmci.env.ts @@ -1,5 +1,6 @@ import "typings-global"; import * as plugins from "./npmci.plugins"; +import * as paths from "./npmci.paths"; import {GitRepo} from "smartstring"; import {Dockerfile} from "./npmci.build.docker" @@ -7,7 +8,19 @@ export let repo:GitRepo = new GitRepo(process.env.CI_BUILD_REPO); export let buildStage:string = process.env.CI_BUILD_STAGE; +// handling config between commands export let dockerRegistry; // will be set by npmci.prepare export let dockerFilesBuilt:Dockerfile[] = []; export let dockerFiles:Dockerfile[] = []; +export let config; + +export let configLoad = () => { + config = plugins.smartfile.local.toObjectSync(paths.NpmciPackageConfig,"json"); + config.dockerRegistry ? dockerRegistry = config.dockerRegistry : void(0); + config.dockerFilesBuilt ? dockerFilesBuilt = config.dockerFilesBuilt : void(0); +} + +export let configStore = () => { + +} \ No newline at end of file diff --git a/ts/npmci.paths.ts b/ts/npmci.paths.ts new file mode 100644 index 0000000..498ab6f --- /dev/null +++ b/ts/npmci.paths.ts @@ -0,0 +1,7 @@ +import "typings-global"; +import * as plugins from "./npmci.plugins"; + +export let cwd = process.cwd(); + +export let NpmciPackageRoot = plugins.path.join(__dirname,"../");# +export let NpmciPackageConfig = plugins.path.join(NpmciPackageRoot,"./config.json") \ No newline at end of file