Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@multiplatform.one/cli

Package Overview
Dependencies
Maintainers
0
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@multiplatform.one/cli - npm Package Compare versions

Comparing version 1.0.28 to 1.0.30

lib/types.d.mts

8

package.json
{
"name": "@multiplatform.one/cli",
"version": "1.0.28",
"version": "1.0.30",
"author": "BitSpur <support@bitspur.com> (https://bitspur.com)",

@@ -51,10 +51,12 @@ "contributors": [

"devDependencies": {
"@types/inquirer": "^9.0.7",
"@types/node": "~20.12.13",
"tsup": "^8.1.0",
"typescript": "~5.3.3",
"@multiplatform.one/utils": "^0.0.13"
"@multiplatform.one/utils": "^0.0.15"
},
"dependencies": {
"commander": "^9.5.0",
"execa": "^9.2.0"
"execa": "^9.2.0",
"inquirer": "^9.2.23"
},

@@ -61,0 +63,0 @@ "transpileModules": [

@@ -22,3 +22,8 @@ /*

import fs from 'fs/promises';
import inquirer from 'inquirer';
import os from 'os';
import path from 'path';
import pkg from '@multiplatform.one/cli/package.json';
import type { CookieCutterConfig } from '../types';
import { execa } from 'execa';

@@ -28,3 +33,5 @@ import { fileURLToPath } from 'url';

process.env.COOKIECUTTER = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/cookiecutter.sh');
program.name('multiplatform.one');
program.version(pkg.version);

@@ -34,7 +41,36 @@ program

.argument('[remote]', 'the remote to use', 'https://gitlab.com/bitspur/multiplatform.one/cookiecutter')
.option('--name <name>', 'the name of the project')
.description('init multiplatform.one')
.action(async (remote) => {
await execa('sh', [path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/init.sh'), remote], {
stdio: 'inherit',
});
if ((await execa('git', ['rev-parse', '--is-inside-work-tree'])).stdout.trim() === 'true') {
throw new Error('multiplatform.one cannot be initialized inside a git repository');
}
const cookieCutterConfig: CookieCutterConfig = {
name:
program.opts().name ||
(
await inquirer.prompt([
{
message: 'What is the project name?',
name: 'name',
type: 'input',
},
])
)?.name,
};
const cookieCutterConfigFile = await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-'));
await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
await execa(
'sh',
[
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/init.sh'),
'-f',
'--config-file',
cookieCutterConfigFile,
remote,
],
{
stdio: 'inherit',
},
);
});

@@ -47,7 +83,39 @@

.action(async (remote) => {
await execa('sh', [path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/update.sh'), remote], {
stdio: 'inherit',
});
if ((await execa('git', ['rev-parse', '--is-inside-work-tree'])).stdout.trim() !== 'true') {
throw new Error('multiplatform.one cannot be updated outside of a git repository');
}
if ((await execa('git', ['diff', '--cached', '--quiet'])).stdout.trim() !== 'true') {
throw new Error('multiplatform.one cannot be updated with uncommitted changes');
}
const projectRoot = (await execa('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
let cookieCutterConfig: CookieCutterConfig | undefined;
if (
(await fs.stat(path.resolve(projectRoot, 'package.json'))).isFile() &&
(await fs.stat(path.resolve(projectRoot, 'app/package.json'))).isFile() &&
JSON.parse(await fs.readFile(path.resolve(projectRoot, 'app/package.json'), 'utf8'))?.dependencies?.[
'multiplatform.one'
]?.length
) {
const name = JSON.parse(await fs.readFile(path.resolve(projectRoot, 'package.json'), 'utf8'))?.name;
if (name) cookieCutterConfig = { name };
}
if (!cookieCutterConfig) throw new Error('not a multiplatform.one project');
const cookieCutterConfigFile = await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-'));
await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
await execa(
'sh',
[
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/update.sh'),
'-f',
'--config-file',
cookieCutterConfigFile,
remote,
],
{
stdio: 'inherit',
cwd: projectRoot,
},
);
});
program.parse(process.argv);

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc