Skip to content

Commit

Permalink
chore: remove rcfile (#2958)
Browse files Browse the repository at this point in the history
  • Loading branch information
kark authored Feb 10, 2023
1 parent b8141f9 commit c8069d8
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 104 deletions.
7 changes: 7 additions & 0 deletions .changeset/beige-moons-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@commercetools-frontend/create-mc-app': patch
'@commercetools-frontend/l10n': patch
'@commercetools-frontend/mc-scripts': patch
---

Replace `rcfile` for reading Prettier config with Prettier API
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
"postcss-modules": "4.3.1",
"prettier": "2.7.1",
"puppeteer": "14.4.1",
"rcfile": "1.0.3",
"replace": "1.2.1",
"rosie": "2.1.0",
"shelljs": "0.8.5",
Expand Down
1 change: 0 additions & 1 deletion packages/create-mc-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"execa": "5.1.1",
"listr2": "5.0.5",
"prettier": "2.7.1",
"rcfile": "1.0.3",
"semver": "7.3.8"
},
"engines": {
Expand Down
15 changes: 8 additions & 7 deletions packages/create-mc-app/src/tasks/update-application-constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os from 'os';
import fs from 'fs';
import path from 'path';
// @ts-ignore
import rcfile from 'rcfile';
import prettier from 'prettier';
import { type PluginItem, transformFileSync, types } from '@babel/core';
import type { ListrTask } from 'listr2';
Expand Down Expand Up @@ -34,12 +32,15 @@ function replaceEntryPointUriPathInConstants(
],
retainLines: true,
});

if (result?.code) {
const prettierConfig = rcfile('prettier', {
cwd: options.projectDirectoryPath,
});
const formattedData = prettier.format(result.code + os.EOL, prettierConfig);
const prettierConfig = prettier.resolveConfig.sync(
options.projectDirectoryPath
);

const formattedData = prettier.format(
result.code + os.EOL,
prettierConfig ?? undefined
);
fs.writeFileSync(filePath, formattedData, {
encoding: 'utf8',
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os from 'os';
import fs from 'fs';
import path from 'path';
// @ts-ignore
import rcfile from 'rcfile';
import prettier from 'prettier';
import { transformFileSync, types, type PluginItem } from '@babel/core';
import type { ListrTask } from 'listr2';
Expand Down Expand Up @@ -57,10 +55,13 @@ function replaceApplicationInfoInCustomApplicationConfig(
});

if (result?.code) {
const prettierConfig = rcfile('prettier', {
cwd: options.projectDirectoryPath,
});
const formattedData = prettier.format(result.code + os.EOL, prettierConfig);
const prettierConfig = prettier.resolveConfig.sync(
options.projectDirectoryPath
);
const formattedData = prettier.format(
result.code + os.EOL,
prettierConfig ?? undefined
);
fs.writeFileSync(filePath, formattedData, {
encoding: 'utf8',
});
Expand Down
3 changes: 1 addition & 2 deletions packages/l10n/scripts/generate-l10n-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ const fs = require('fs');
const path = require('path');
const cldr = require('cldr');
const chalk = require('chalk');
const rcfile = require('rcfile');
const fetch = require('node-fetch');
const moment = require('moment-timezone');
const deepDiff = require('deep-diff');
const isEqual = require('lodash/isEqual');
const difference = require('lodash/difference');
const parseUnhandledTimeZones = require('./parse-unhandled-time-zones');

const prettierConfig = rcfile('prettier');
const prettierConfig = prettier.resolveConfig.sync();

const L10N_KEYS = {
COUNTRY: 'country',
Expand Down
1 change: 0 additions & 1 deletion packages/mc-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"prettier": "2.7.1",
"prompts": "^2.4.2",
"querystring-es3": "^0.2.1",
"rcfile": "1.0.3",
"react-dev-utils": "12.0.1",
"react-refresh": "0.14.0",
"serve-handler": "6.1.3",
Expand Down
87 changes: 1 addition & 86 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4099,7 +4099,6 @@ __metadata:
execa: 5.1.1
listr2: 5.0.5
prettier: 2.7.1
rcfile: 1.0.3
semver: 7.3.8
bin:
create-mc-app: ./bin/cli.js
Expand Down Expand Up @@ -4336,7 +4335,6 @@ __metadata:
prettier: 2.7.1
prompts: ^2.4.2
querystring-es3: ^0.2.1
rcfile: 1.0.3
react-dev-utils: 12.0.1
react-refresh: 0.14.0
rimraf: 3.0.2
Expand Down Expand Up @@ -15258,15 +15256,6 @@ __metadata:
languageName: node
linkType: hard

"caller-path@npm:^0.1.0":
version: 0.1.0
resolution: "caller-path@npm:0.1.0"
dependencies:
callsites: ^0.2.0
checksum: f4f2216897d2c150e30d06c6a9243115e500184433b42d597f0b8816fda8f6b7f782dba39fc37310dcc67c90e1112729709d3bb9e10983552e76632250b075f3
languageName: node
linkType: hard

"caller-path@npm:^2.0.0":
version: 2.0.0
resolution: "caller-path@npm:2.0.0"
Expand All @@ -15276,13 +15265,6 @@ __metadata:
languageName: node
linkType: hard

"callsites@npm:^0.2.0":
version: 0.2.0
resolution: "callsites@npm:0.2.0"
checksum: 7ed36d5565ec37600fd9642b6e1e00915c078bf2d1c536115c45fe9c07969b50a7d7db61384e533625fa9fee3e6187740784722f0636d52a99419111284cc236
languageName: node
linkType: hard

"callsites@npm:^2.0.0":
version: 2.0.0
resolution: "callsites@npm:2.0.0"
Expand Down Expand Up @@ -26311,15 +26293,6 @@ __metadata:
languageName: node
linkType: hard

"json5@npm:^0.5.0":
version: 0.5.1
resolution: "json5@npm:0.5.1"
bin:
json5: lib/cli.js
checksum: 9b85bf06955b23eaa4b7328aa8892e3887e81ca731dd27af04a5f5f1458fbc5e1de57a24442e3272f8a888dd1abe1cb68eb693324035f6b3aeba4fcab7667d62
languageName: node
linkType: hard

"json5@npm:^1.0.1":
version: 1.0.1
resolution: "json5@npm:1.0.1"
Expand Down Expand Up @@ -28073,7 +28046,6 @@ __metadata:
postcss-modules: 4.3.1
prettier: 2.7.1
puppeteer: 14.4.1
rcfile: 1.0.3
replace: 1.2.1
rosie: 2.1.0
shelljs: 0.8.5
Expand Down Expand Up @@ -29458,7 +29430,7 @@ __metadata:
languageName: node
linkType: hard

"object-keys@npm:^1.0.11, object-keys@npm:^1.0.12, object-keys@npm:^1.0.9, object-keys@npm:^1.1.0, object-keys@npm:^1.1.1":
"object-keys@npm:^1.0.11, object-keys@npm:^1.0.12, object-keys@npm:^1.1.0, object-keys@npm:^1.1.1":
version: 1.1.1
resolution: "object-keys@npm:1.1.1"
checksum: b363c5e7644b1e1b04aa507e88dcb8e3a2f52b6ffd0ea801e4c7a62d5aa559affe21c55a07fd4b1fd55fc03a33c610d73426664b20032405d7b92a1414c34d6a
Expand Down Expand Up @@ -30226,15 +30198,6 @@ __metadata:
languageName: node
linkType: hard

"path-exists@npm:^2.1.0":
version: 2.1.0
resolution: "path-exists@npm:2.1.0"
dependencies:
pinkie-promise: ^2.0.0
checksum: fdb734f1d00f225f7a0033ce6d73bff6a7f76ea08936abf0e5196fa6e54a645103538cd8aedcb90d6d8c3fa3705ded0c58a4da5948ae92aa8834892c1ab44a84
languageName: node
linkType: hard

"path-exists@npm:^3.0.0":
version: 3.0.0
resolution: "path-exists@npm:3.0.0"
Expand Down Expand Up @@ -30432,22 +30395,6 @@ __metadata:
languageName: node
linkType: hard

"pinkie-promise@npm:^2.0.0":
version: 2.0.1
resolution: "pinkie-promise@npm:2.0.1"
dependencies:
pinkie: ^2.0.0
checksum: b53a4a2e73bf56b6f421eef711e7bdcb693d6abb474d57c5c413b809f654ba5ee750c6a96dd7225052d4b96c4d053cdcb34b708a86fceed4663303abee52fcca
languageName: node
linkType: hard

"pinkie@npm:^2.0.0":
version: 2.0.4
resolution: "pinkie@npm:2.0.4"
checksum: b12b10afea1177595aab036fc220785488f67b4b0fc49e7a27979472592e971614fa1c728e63ad3e7eb748b4ec3c3dbd780819331dad6f7d635c77c10537b9db
languageName: node
linkType: hard

"pirates@npm:^4.0.1, pirates@npm:^4.0.4":
version: 4.0.4
resolution: "pirates@npm:4.0.4"
Expand Down Expand Up @@ -31731,21 +31678,6 @@ __metadata:
languageName: node
linkType: hard

"rcfile@npm:1.0.3":
version: 1.0.3
resolution: "rcfile@npm:1.0.3"
dependencies:
debug: ^2.2.0
js-yaml: ^3.6.1
json5: ^0.5.0
object-assign: ^4.1.0
object-keys: ^1.0.9
path-exists: ^2.1.0
require-uncached: ^1.0.2
checksum: 4e4554f6270898bcb2914112d5f8bdcb24373a1321ab96bd011e29333321a4a407592efcb1d7bafa2abf7c79da4ec0b659eca867dc2b3e8f55027fb2ee652b1b
languageName: node
linkType: hard

"react-dev-utils@npm:12.0.1, react-dev-utils@npm:^12.0.1":
version: 12.0.1
resolution: "react-dev-utils@npm:12.0.1"
Expand Down Expand Up @@ -32885,16 +32817,6 @@ __metadata:
languageName: node
linkType: hard

"require-uncached@npm:^1.0.2":
version: 1.0.3
resolution: "require-uncached@npm:1.0.3"
dependencies:
caller-path: ^0.1.0
resolve-from: ^1.0.0
checksum: ace5261d38072130d1fefcfe9662b0d038fe1e38988a801be3e90fbfcab9f6786eeadcf53ac36d6d81b676b29649c7dc5719be0ee571f63058f842838d704bee
languageName: node
linkType: hard

"requireindex@npm:^1.2.0":
version: 1.2.0
resolution: "requireindex@npm:1.2.0"
Expand Down Expand Up @@ -32949,13 +32871,6 @@ __metadata:
languageName: node
linkType: hard

"resolve-from@npm:^1.0.0":
version: 1.0.1
resolution: "resolve-from@npm:1.0.1"
checksum: 10134654dd6e758d4a4ad60acf69a90731673058a1a96068afc5f2ee84ac373df4d0237e0f052b5c81cc076273213ed50d228fc09723e0840c5c61ea37eb8854
languageName: node
linkType: hard

"resolve-from@npm:^3.0.0":
version: 3.0.0
resolution: "resolve-from@npm:3.0.0"
Expand Down

1 comment on commit c8069d8

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for merchant-center-application-kit ready!

✅ Preview
https://merchant-center-application-5b0vxnur9-commercetools.vercel.app

Built with commit c8069d8.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.