feat(packaging): Rename package scope to @git.zone and migrate to ESM; rename CLI/config keys, update entrypoints and imports, bump Node requirement to 18, and adjust scripts/dependencies
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tsdocker',
|
||||
version: '1.2.43',
|
||||
version: '1.3.0',
|
||||
description: 'develop npm modules cross platform with docker'
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as cli from './tsdocker.cli';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as cli from './tsdocker.cli.js';
|
||||
|
||||
cli.run();
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as paths from './tsdocker.paths';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as paths from './tsdocker.paths.js';
|
||||
|
||||
// modules
|
||||
import * as ConfigModule from './tsdocker.config';
|
||||
import * as DockerModule from './tsdocker.docker';
|
||||
import * as ConfigModule from './tsdocker.config.js';
|
||||
import * as DockerModule from './tsdocker.docker.js';
|
||||
|
||||
import { logger, ora } from './tsdocker.logging';
|
||||
import { logger, ora } from './tsdocker.logging.js';
|
||||
|
||||
const tsdockerCli = new plugins.smartcli.Smartcli();
|
||||
|
||||
export let run = () => {
|
||||
tsdockerCli.standardTask().subscribe(async argvArg => {
|
||||
tsdockerCli.standardCommand().subscribe(async argvArg => {
|
||||
const configArg = await ConfigModule.run().then(DockerModule.run);
|
||||
if (configArg.exitCode === 0) {
|
||||
logger.log('success', 'container ended all right!');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as paths from './tsdocker.paths';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as paths from './tsdocker.paths.js';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export interface IConfig {
|
||||
@@ -22,7 +22,7 @@ const getQenvKeyValueObject = async () => {
|
||||
|
||||
const buildConfig = async (qenvKeyValueObjectArg: { [key: string]: string | number }) => {
|
||||
const npmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
const config = npmextra.dataFor<IConfig>('npmdocker', {
|
||||
const config = npmextra.dataFor<IConfig>('@git.zone/tsdocker', {
|
||||
baseImage: 'hosttoday/ht-docker-node:npmdocker',
|
||||
init: 'rm -rf node_nodules/ && yarn install',
|
||||
command: 'npmci npm test',
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as paths from './tsdocker.paths';
|
||||
import * as snippets from './tsdocker.snippets';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as paths from './tsdocker.paths.js';
|
||||
import * as snippets from './tsdocker.snippets.js';
|
||||
|
||||
import { logger, ora } from './tsdocker.logging';
|
||||
import { logger, ora } from './tsdocker.logging.js';
|
||||
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
});
|
||||
|
||||
// interfaces
|
||||
import { IConfig } from './tsdocker.config';
|
||||
import type { IConfig } from './tsdocker.config.js';
|
||||
|
||||
let config: IConfig;
|
||||
|
||||
@@ -67,7 +67,7 @@ const buildDockerImage = async () => {
|
||||
await smartshellInstance.exec(`docker pull ${config.baseImage}`);
|
||||
ora.text('building Dockerimage...');
|
||||
const execResult = await smartshellInstance.execSilent(
|
||||
`docker build -f npmdocker -t ${dockerData.imageTag} ${paths.cwd}`
|
||||
`docker build --load -f npmdocker -t ${dockerData.imageTag} ${paths.cwd}`
|
||||
);
|
||||
if (execResult.exitCode !== 0) {
|
||||
console.log(execResult.stdout);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
|
||||
export const logger = new plugins.smartlog.Smartlog({
|
||||
logContext: {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
import * as fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
// directories
|
||||
export let cwd = process.cwd();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as plugins from './tsdocker.plugins';
|
||||
import * as plugins from './tsdocker.plugins.js';
|
||||
|
||||
export interface IDockerfileSnippet {
|
||||
baseImage: string;
|
||||
@@ -14,23 +14,20 @@ let getMountSolutionString = (optionsArg: IDockerfileSnippet) => {
|
||||
};
|
||||
|
||||
let getGlobalPreparationString = (optionsArg: IDockerfileSnippet) => {
|
||||
if (optionsArg.baseImage !== 'hosttoday/ht-docker-node:npmdocker') {
|
||||
return 'RUN npm install -g npmdocker';
|
||||
} else {
|
||||
return '# not installing npmdocker since it is included in the base image';
|
||||
}
|
||||
// Always install tsdocker to ensure the latest version is available
|
||||
return 'RUN npm install -g @git.zone/tsdocker';
|
||||
};
|
||||
|
||||
export let dockerfileSnippet = (optionsArg: IDockerfileSnippet): string => {
|
||||
return plugins.smartstring.indent.normalize(
|
||||
`
|
||||
FROM ${optionsArg.baseImage}
|
||||
# For info about what npmdocker does read the docs at https://gitzone.github.io/npmdocker
|
||||
# For info about what tsdocker does read the docs at https://gitzone.github.io/tsdocker
|
||||
${getGlobalPreparationString(optionsArg)}
|
||||
${getMountSolutionString(optionsArg)}
|
||||
WORKDIR /workspace
|
||||
ENV CI=true
|
||||
ENTRYPOINT ["npmdocker"]
|
||||
ENTRYPOINT ["tsdocker"]
|
||||
CMD ["runinside"]
|
||||
`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user