Skip to content

Commit

Permalink
Move package.json to parent directory (SchemaStore#3801)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperupcall authored May 27, 2024
1 parent fd34cd8 commit add4b48
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 69 deletions.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Adding a JSON schema file to the catalog is required.
Add tests files. (.json, .yml, .yaml or .toml)
Use the most recent JSON Schema version that's well supported by editors and IDEs, currently draft-07.
JSON formatted according to the .editorconfig settings.
-->
6 changes: 2 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: '18'
cache-dependency-path: src/package-lock.json
cache: 'npm'
cache-dependency-path: './package-lock.json'
- name: npm ci
run: |
cd src
npm ci
- name: npm run build
run: |
cd src
npm run build
15 changes: 2 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#################
## Prettier
#################
# This ignore file is shared with Prettier. It seems .git/ must be ignored manually now.
.git/

#################
## Visual Studio
#################

# Project files
temp
test.json
*.webinfo
.vs/
Expand All @@ -26,7 +21,6 @@ test.json
node_modules/

# Build results

packages/
[Oo]bj/

Expand Down Expand Up @@ -109,10 +103,6 @@ publish/
*.Publish.xml
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef
Expand All @@ -132,7 +122,6 @@ ClientBin/
*.pfx
*.publishsettings
.DS_Store
src/temp

# RIA/Silverlight projects
Generated_Code/
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ repos:
- '[email protected]'
- '[email protected]'
pass_filenames: true
entry: './src/scripts/pre-commit-script.sh'
args: ['--no-color', '--log-level=warn', '--write']
- repo: 'https://github.com/codespell-project/codespell'
rev: 'v2.2.6'
hooks:
- id: 'codespell'
exclude: '^src/(package-lock.json|test/openutau-ustx/bulaomeng.ustx.yaml|test/kustomization/labels.json|bin/.*)$'
exclude: '^(package-lock.json|src/test/openutau-ustx/bulaomeng.ustx.yaml|src/test/kustomization/labels.json|src/bin/.*)$'
args:
[
'-Lcrate,ninjs,ans,specif,seh,specifid,deriver,isnt,tye,forin,dependees,rouge,interm,fo,wast,nome,statics,ue,aack,gost,inout,provId,handels,bu,testng,ags,edn,aks,te,decorder,provid,branche,alse,nd,mape,wil,clude,wit,flate,omlet',
Expand Down
22 changes: 3 additions & 19 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
/** @type {unknown} */
let prettierPluginSortJson
try {
// When running scripts locally (through npm-run-script), the relative path of the plugin
// must be specified since 'require.resolve' will not find it by itself in subdirectory 'src'.
prettierPluginSortJson = require.resolve(
'./src/node_modules/prettier-plugin-sort-json',
)
} catch (err) {
// In pre-commit CI, 'prettier-plugin-sort-json' is installed to some directory (which is in $NODE_PATH).
// As as result, simply require.resolve to find the full path to the dependency.
prettierPluginSortJson = require.resolve('prettier-plugin-sort-json')
}
if (!prettierPluginSortJson) {
throw new Error(`Failed to import plugin: 'prettier-plugin-sort-json'`)
}

/** @type {import('./src/node_modules/prettier').Config} */
/** @type {import('prettier').Config} */
module.exports = {
plugins: [prettierPluginSortJson],
// pre-commit.ci fails without `require.resolve()`.
plugins: [require.resolve('prettier-plugin-sort-json')],
semi: false,
singleQuote: true,
trailingComma: 'all',
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,9 @@ git clone https://github.com/SchemaStore/schemastore
cd schemastore
```

Be sure that [NodeJS](https://nodejs.org) is installed. The minimum required NodeJS version is defined by the `engines` key in [package.json](src/package.json). Now, install dependencies and run the `new_schema` Grunt task:
Be sure that [NodeJS](https://nodejs.org) is installed. The minimum required NodeJS version is defined by the `engines` key in [package.json](package.json). Now, install dependencies and run the `new_schema` Grunt task:

```sh
cd src
npm install
npm run grunt new_schema
```
Expand Down Expand Up @@ -280,7 +279,7 @@ git clone https://github.com/SchemaStore/schemastore
cd schemastore
```

Be sure that [NodeJS](https://nodejs.org) is installed. The minimum required NodeJS version is defined by the `engines` key in [package.json](src/package.json).
Be sure that [NodeJS](https://nodejs.org) is installed. The minimum required NodeJS version is defined by the `engines` key in [package.json](package.json).

Now, modify the schema you intend to modify. Schemas are located under `src/schemas/json`.

Expand Down
15 changes: 8 additions & 7 deletions src/Gruntfile.cjs → Gruntfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ const axios = require('axios').default
const jsonlint = require('@prantlf/jsonlint')
const jsoncParser = require('jsonc-parser')

const temporaryCoverageDir = 'temp'
const schemaDir = 'schemas/json'
const testPositiveDir = 'test'
const testNegativeDir = 'negative_test'
const temporaryCoverageDir = './temp'
const schemaDir = './src/schemas/json'
const testPositiveDir = './src/test'
const testNegativeDir = './src/negative_test'
const urlSchemaStore = 'https://json.schemastore.org/'
const catalog = require('./api/json/catalog.json')
const catalog = require('./src/api/json/catalog.json')
const schemaValidation = jsoncParser.parse(
fs.readFileSync('./schema-validation.json', 'utf-8'),
fs.readFileSync('./src/schema-validation.json', 'utf-8'),
)
const schemasToBeTested = fs.readdirSync(schemaDir)
const foldersPositiveTest = fs.readdirSync(testPositiveDir)
Expand Down Expand Up @@ -966,7 +966,7 @@ module.exports = function (/** @type {import('grunt')} */ grunt) {
'local_assert_catalog.json_passes_jsonlint',
'Check that catalog.json passes jsonlint',
function () {
jsonlint.parse(fs.readFileSync('./api/json/catalog.json', 'utf-8'), {
jsonlint.parse(fs.readFileSync('./src/api/json/catalog.json', 'utf-8'), {
ignoreBOM: false,
ignoreComments: false,
ignoreTrailingCommas: false,
Expand Down Expand Up @@ -1973,6 +1973,7 @@ module.exports = function (/** @type {import('grunt')} */ grunt) {
}

// Prettify the JavaScript module code
// TODO: https://github.com/prettier/prettier/pull/12788
const prettierOptions = prettier.resolveConfig.sync(process.cwd())
fs.writeFileSync(
javaScriptCoverageNameWithPath,
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions src/package.json → package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "schemastore.org",
"version": "1.0.0",
"description": "A collection of JSON Schemas",
"readme": "../README.md",
"private": true,
"homepage": "https://schemastore.org",
"bugs": {
Expand All @@ -19,8 +18,8 @@
"type": "commonjs",
"scripts": {
"grunt": "grunt",
"prettier": "prettier --config ../.prettierrc.cjs --ignore-path ../.gitignore --check ..",
"prettier:fix": "prettier --config ../.prettierrc.cjs --ignore-path ../.gitignore --write ..",
"prettier": "prettier --config .prettierrc.cjs --ignore-path .gitignore --check .",
"prettier:fix": "prettier --config .prettierrc.cjs --ignore-path .gitignore --write .",
"eslint": "eslint Gruntfile.cjs",
"eslint:fix": "eslint --fix Gruntfile.cjs",
"build": "npm run eslint && grunt && ./scripts/dirty_repository_check.sh",
Expand Down
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions src/scripts/pre-commit-script.sh

This file was deleted.

0 comments on commit add4b48

Please sign in to comment.