From 8be1c6e91cb0db6b6a24fc1e4c09f6ef92167834 Mon Sep 17 00:00:00 2001 From: Aron Date: Fri, 23 Feb 2024 22:51:48 +0800 Subject: [PATCH] Update tsconfig.json, package.json, and metadata.ts --- packages/create/package.json | 3 +- packages/create/src/bin/index.ts | 23 +++++----- pnpm-lock.yaml | 45 +++++-------------- tsconfig.json | 1 - .../(root)/docs/introduction/metadata.ts | 10 ++++- 5 files changed, 29 insertions(+), 53 deletions(-) diff --git a/packages/create/package.json b/packages/create/package.json index ce5f10b80..4a5ab40a4 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -36,12 +36,11 @@ "access": "public" }, "dependencies": { - "@master/css": "2.0.0-rc.13", "@techor/fs": "^3.0.11", "@techor/log": "^3.0.11", "commander": "^12.0.0", + "detect-package-manager": "^3.0.1", "giget": "^1.2.1", - "nypm": "^0.3.6", "ora": "^8.0.1" }, "devDependencies": { diff --git a/packages/create/src/bin/index.ts b/packages/create/src/bin/index.ts index 01e510f0c..a9934b62b 100644 --- a/packages/create/src/bin/index.ts +++ b/packages/create/src/bin/index.ts @@ -4,7 +4,7 @@ import { resolve } from 'node:path' import { Command } from 'commander' import { readJSONFileSync } from '@techor/fs' import log from '@techor/log' -import { PackageManager, addDependency, detectPackageManager, installDependencies, packageManagers } from 'nypm' +import { detect as detectPackageManager, PM } from 'detect-package-manager' import detectAppExt from '../detect-app-ext' import detectAppTech from '../detect-app-tech' import { downloadTemplate } from 'giget' @@ -35,15 +35,12 @@ program .option('--pm ', 'Specify the package manager npm, yarn, pnpm, bun') .option('--example ', 'Specify the example folder name', 'blank') .action(async function (appName: string | undefined, options: Options) { - let pm: PackageManager - if (options.pm) { - pm = packageManagers.find((eachPM) => eachPM.name === options.pm)! - } else { - pm = await detectPackageManager(process.cwd()) || packageManagers.find((eachPM) => eachPM.name === 'npm')! + if (!options.pm) { + options.pm = await detectPackageManager() } // Create a new app with the example if (appName) { - log.i(`Detected **${pm.name}**`) + log.i(`Detected **${options.pm}**`) const spinner = ora(`Initializing Master CSS`).start() const examplePath = `github:master-co/css/examples/${options.example}#${BRANCH}` spinner.start(`Cloning example from "${examplePath}"`) @@ -80,15 +77,15 @@ program writeFileSync('package.json', JSON.stringify(appPkg, null, 4), { flag: 'w' }) spinner.stop() log.ok`Cloned example from "${examplePath}"` - log.i`Start "${pm.name} install" for dependencies: ${targetPackages}` + log.i`Start "${options.pm} install" for dependencies: ${targetPackages}` log`` try { - await installDependencies({ packageManager: pm }) + execSync(`${options.pm} install`, { stdio: 'inherit' }) log`` log.ok`Created **${appName}**` log.i`Commands in this app:` console.table(appPkg.scripts) - log.i`Start by running "cd ${appName} && ${pm.command} run ${appPkg.scripts?.dev ? 'dev' : 'start'}"` + log.i`Start by running "cd ${appName} && ${options.pm} run ${appPkg.scripts?.dev ? 'dev' : 'start'}"` } catch (error) { spinner.fail() throw error @@ -121,10 +118,10 @@ program break } if (!appPkg?.dependencies?.['@master/css']) { - log.i(`Detected **${pm.name}**`) - log.i`Start "${pm.command} add @master/css@${BRANCH}"` + log.i(`Detected **${options.pm}**`) + log.i`Start "${options.pm} add @master/css@${BRANCH}"` log`` - addDependency(`@master/css@${BRANCH}`, { packageManager: pm }) + execSync(`${options.pm} add @master/css@rc`, { stdio: 'inherit' }) log`` } const tech = detectAppTech() diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fffa20838..d72973ade 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1031,9 +1031,6 @@ importers: packages/create: dependencies: - '@master/css': - specifier: 2.0.0-rc.13 - version: 2.0.0-rc.13 '@techor/fs': specifier: ^3.0.11 version: 3.0.11 @@ -1043,12 +1040,12 @@ importers: commander: specifier: ^12.0.0 version: 12.0.0 + detect-package-manager: + specifier: ^3.0.1 + version: 3.0.1 giget: specifier: ^1.2.1 version: 1.2.1 - nypm: - specifier: ^0.3.6 - version: 0.3.6 ora: specifier: ^8.0.1 version: 8.0.1 @@ -5651,20 +5648,6 @@ packages: - supports-color dev: true - /@master/css@2.0.0-rc.13: - resolution: {integrity: sha512-auaoUEmt8UjBU9F8EsDGYdddnVJmCMkorCxFXGiWK590Sg0lKO9pfBVgxMgqvmrMzUSo2kHABm/wjLoxmlScYQ==} - hasBin: true - dependencies: - '@master/normal.css': 2.0.0-rc.15 - '@techor/fs': 2.6.7 - '@techor/log': 2.6.7 - commander: 11.1.0 - dev: false - - /@master/normal.css@2.0.0-rc.15: - resolution: {integrity: sha512-mkjN5GjGNp4Z/TYpcL74oDY+rZwfjUxRMLlE2zmXBNJKZfdlv3xaEJMJCDo+HNez+MYOsczpfn8GFJwVLa/8HA==} - dev: false - /@mdn/browser-compat-data@5.5.11: resolution: {integrity: sha512-4o1ZaGmvqoDx3QLyEAcZvGDKmdVXLB0aiANuPDumgue/7iH67KUBsKejLX7wrdxEdyNYfXUKtjFQYhGwVUBXGw==} dev: false @@ -8172,10 +8155,6 @@ packages: /@techor/extend@3.0.11: resolution: {integrity: sha512-9Y+x1xt/qzOffMqzk8K5tflJuEFFhrlWh+R+8f/hIQGMs9h1lxgjAEkRPhOyKtnb4gQepDVDx2AUizYUIL2GPA==} - /@techor/fs@2.6.7: - resolution: {integrity: sha512-KNSGJxws2pPD5aXPlTsq2JrTqraQsG4pnN6GkYmlQ0VFAPA8w3fdtUFpqO+zlDW1pTeKQaDTZONl28Zt68BBig==} - dev: false - /@techor/fs@3.0.11: resolution: {integrity: sha512-2DWQXj3wEN+Mm2heqerhixOvkrZb310uFIUY3s0Ukz2Q/BCLc+UKFn0aG6C027H1S/iuZw+dVmRmHQYRSq08bw==} dev: false @@ -8224,10 +8203,6 @@ packages: - '@swc/helpers' dev: false - /@techor/log@2.6.7: - resolution: {integrity: sha512-c4UAijQhwKgJepk06438nLbaGrIMyV5CP0qbByrWst3EeD2BuSefjbRQNJlV3OQTV1+9lSmX4ANy0qK2l6xl4Q==} - dev: false - /@techor/log@3.0.11: resolution: {integrity: sha512-CRfhZIWtTDh5WsEh1M97F840WarSSFRlCh1kn+KNGqHfc/VvdITXSfbUVJ0IewY9heebY5q8k+TZJEsh4MCR+A==} dev: false @@ -11782,11 +11757,6 @@ packages: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} engines: {node: '>=14'} - /commander@11.1.0: - resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} - engines: {node: '>=16'} - dev: false - /commander@12.0.0: resolution: {integrity: sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==} engines: {node: '>=18'} @@ -12758,6 +12728,13 @@ packages: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} dev: true + /detect-package-manager@3.0.1: + resolution: {integrity: sha512-qoHDH6+lMcpJPAScE7+5CYj91W0mxZNXTwZPrCqi1KMk+x+AoQScQ2V1QyqTln1rHU5Haq5fikvOGHv+leKD8A==} + engines: {node: '>=12'} + dependencies: + execa: 5.1.1 + dev: false + /deterministic-object-hash@1.3.1: resolution: {integrity: sha512-kQDIieBUreEgY+akq0N7o4FzZCr27dPG1xr3wq267vPwDlSXQ3UMcBXHqTGUBaM/5WDS1jwTYjxRhUzHeuiAvw==} dev: false @@ -17485,8 +17462,6 @@ packages: peerDependenciesMeta: webpack: optional: true - webpack-sources: - optional: true dependencies: webpack: 5.90.1(@swc/core@1.4.2)(esbuild@0.20.0) webpack-sources: 3.2.3 diff --git a/tsconfig.json b/tsconfig.json index a9aecf8e1..82a41e99b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "experimentalDecorators": true, - "baseUrl": ".", "moduleResolution": "Node", "allowSyntheticDefaultImports": true, "esModuleInterop": true, diff --git a/website/app/[locale]/(root)/docs/introduction/metadata.ts b/website/app/[locale]/(root)/docs/introduction/metadata.ts index c82cf4d24..37c489a4b 100644 --- a/website/app/[locale]/(root)/docs/introduction/metadata.ts +++ b/website/app/[locale]/(root)/docs/introduction/metadata.ts @@ -1,11 +1,17 @@ import { Metadata } from 'websites/types/Metadata' const metadata: Metadata = { - title: 'Introduction', + title: 'The All-in-One CSS Solution for Building Modern and Performant Websites', description: 'Get a quick overview of Master CSS and its benefits.', category: 'Getting Started', disabled: true, - order: 1 + order: 1, + openGraph: { + title: 'Introduction' + }, + other: { + subject: 'Introduction' + } } export default metadata \ No newline at end of file