Skip to content

Commit

Permalink
chore(pack-up): remove from monorepo (v5) (#20092)
Browse files Browse the repository at this point in the history
* chore(pack-up): remove from repo

* chore: type fixes

* chore: add suggestions to tighten types

Co-authored-by: Ben Irvin <ben.irvin@strapi.io>

---------

Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
  • Loading branch information
joshuaellis and innerdvations committed Apr 12, 2024
1 parent 01a203b commit bc71a96
Show file tree
Hide file tree
Showing 126 changed files with 653 additions and 5,434 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
"@swc/core": "1.4.8",
"@swc/helpers": "0.5.7",
"@swc/jest": "0.2.36",
"@types/git-url-parse": "9.0.3",
"@types/prompts": "2.4.9",
"@types/react": "18.2.66",
"@types/react-dom": "18.2.22",
"@types/styled-components": "5.1.34",
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
},
"devDependencies": {
"@reduxjs/toolkit": "1.9.7",
"@strapi/pack-up": "workspace:*",
"@strapi/pack-up": "5.0.0",
"@testing-library/jest-dom": "5.16.5",
"eslint-config-custom": "5.0.0-beta.3",
"jest-environment-jsdom": "29.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/create-strapi-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"inquirer": "8.2.5"
},
"devDependencies": {
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"eslint-config-custom": "5.0.0-beta.3",
"tsconfig": "5.0.0-beta.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/create-strapi-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ora": "5.4.1"
},
"devDependencies": {
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"eslint-config-custom": "5.0.0-beta.3",
"tsconfig": "5.0.0-beta.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"devDependencies": {
"@strapi/admin-test-utils": "5.0.0-beta.3",
"@strapi/data-transfer": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@types/codemirror5": "npm:@types/codemirror@^5.60.15",
"@types/invariant": "2.2.36",
"@types/js-cookie": "3.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/server/src/controllers/user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Context } from 'koa';

import _ = require('lodash');
import * as _ from 'lodash';
import { errors } from '@strapi/utils';
import {
validateUserCreationInput,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/admin/server/src/services/permission/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const deleteByRolesIds = async (rolesIds: Data.ID[]): Promise<void> => {
* @param ids ids of permissions
*/
export const deleteByIds = async (ids: Data.ID[]): Promise<void> => {
const result = [];
const result: unknown[] = [];
for (const id of ids) {
const queryResult = await strapi.db.query('admin::permission').delete({ where: { id } });
result.push(queryResult);
Expand All @@ -41,7 +41,7 @@ export const deleteByIds = async (ids: Data.ID[]): Promise<void> => {
* @param permissions
*/
export const createMany = async (permissions: CreatePermissionPayload[]): Promise<Permission[]> => {
const createdPermissions = [];
const createdPermissions: CreatePermissionPayload[] = [];
for (const permission of permissions) {
const newPerm = await strapi.db.query('admin::permission').create({ data: permission });
createdPermissions.push(newPerm);
Expand Down Expand Up @@ -90,7 +90,7 @@ export const findUserPermissions = async (user: AdminUser): Promise<Permission[]
const filterPermissionsToRemove = async (permissions: Permission[]) => {
const { actionProvider } = getService('permission');

const permissionsToRemove = [];
const permissionsToRemove: Permission[] = [];

for (const permission of permissions) {
const { subjects, options = {} as Action['options'] } =
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/server/src/services/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const deleteByIds = async (ids = [] as Data.ID[]): Promise<AdminRole[]> => {

await getService('permission').deleteByRolesIds(ids);

const deletedRoles = [];
const deletedRoles: AdminRole[] = [];
for (const id of ids) {
const deletedRole = await strapi.db.query('admin::role').delete({ where: { id } });

Expand Down
2 changes: 1 addition & 1 deletion packages/core/content-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"devDependencies": {
"@strapi/admin": "5.0.0-beta.3",
"@strapi/database": "workspace:*",
"@strapi/pack-up": "workspace:*",
"@strapi/pack-up": "5.0.0",
"@testing-library/react": "14.0.0",
"@types/jest": "29.5.2",
"@types/lodash": "^4.14.191",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ function syncLayouts(configuration: any, schema: any) {
// backward compatibility with when relations were on the side of the layout
// it migrates the displayed relations to the main edit layout
const elementsToReAppend = [...cleanEditRelations];
let cleanEdit = [];
let cleanEdit: unknown[] = [];
for (const row of edit) {
const newRow = [];
const newRow: unknown[] = [];

for (const el of row) {
if (!hasEditableAttribute(schema, el.name)) continue;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/content-releases/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"devDependencies": {
"@strapi/admin": "5.0.0-beta.3",
"@strapi/admin-test-utils": "5.0.0-beta.3",
"@strapi/pack-up": "workspace:*",
"@strapi/pack-up": "5.0.0",
"@strapi/plugin-content-manager": "5.0.0-beta.3",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/content-type-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"devDependencies": {
"@strapi/admin": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@strapi/types": "5.0.0-beta.3",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const formatContentType = (contentType: any) => {

export const createContentTypes = async (contentTypes: any[]) => {
const builder = createBuilder();
const createdContentTypes = [];
const createdContentTypes: any[] = [];

for (const contentType of contentTypes) {
createdContentTypes.push(await createContentType(contentType, { defaultBuilder: builder }));
Expand Down
4 changes: 2 additions & 2 deletions packages/core/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@strapi/generate-new": "5.0.0-beta.3",
"@strapi/generators": "5.0.0-beta.3",
"@strapi/logger": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@strapi/permissions": "5.0.0-beta.3",
"@strapi/types": "5.0.0-beta.3",
"@strapi/typescript-utils": "5.0.0-beta.3",
Expand Down Expand Up @@ -106,7 +106,7 @@
"yup": "0.32.9"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"@strapi/pack-up": "5.0.0",
"@strapi/ts-zen": "^0.2.0",
"@types/bcryptjs": "2.4.3",
"@types/configstore": "5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/core/src/services/entity-validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ const buildRelationsStore = <TUID extends UID.Schema>({
* mentioned exists
*/
const checkRelationsExist = async (relationsStore: Record<string, ID[]> = {}) => {
const promises = [];
const promises: Promise<void>[] = [];

for (const [key, value] of Object.entries(relationsStore)) {
const evaluate = async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/data-transfer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"devDependencies": {
"@strapi/database": "workspace:*",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@types/fs-extra": "9.0.13",
"@types/jest": "29.5.2",
"@types/koa": "2.13.4",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/data-transfer/src/utils/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ const deleteComponents = async <TUID extends UID.Schema, TEntity extends Data.En
************************** */

// components can have nested compos so this must be recursive
const createComponent = async <TUID extends UID.Component>(
const createComponent = async <TUID extends UID.Component = UID.Component>(
uid: TUID,
data: Modules.EntityService.Params.Data.Input<TUID>
) => {
const model = strapi.getModel(uid);
const model = strapi.getModel(uid) as Schema.Component;

const componentData = await createComponents(uid, data);
const transform = pipe(
Expand All @@ -439,7 +439,7 @@ const updateComponent = async <TUID extends UID.Component>(
componentToUpdate: { id: Modules.EntityService.Params.Attribute.ID },
data: Modules.EntityService.Params.Data.Input<TUID>
) => {
const model = strapi.getModel(uid);
const model = strapi.getModel(uid) as Schema.Component;

const componentData = await updateComponents(uid, componentToUpdate, data);

Expand Down
2 changes: 1 addition & 1 deletion packages/core/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"umzug": "3.2.1"
},
"devDependencies": {
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"eslint-config-custom": "5.0.0-beta.3",
"tsconfig": "5.0.0-beta.3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class SqliteSchemaInspector implements SchemaInspector {
async getIndexes(tableName: string): Promise<Index[]> {
const indexes = await this.db.connection.raw<RawIndex[]>(SQL_QUERIES.INDEX_LIST, [tableName]);

const ret = [];
const ret: Index[] = [];

for (const index of indexes.filter((index) => !index.name.startsWith('sqlite_'))) {
const res = await this.db.connection.raw<RawIndexInfo[]>(SQL_QUERIES.INDEX_INFO, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const deleteRelatedMorphOneRelationsAfterMorphToManyUpdate = async (

const typeAndFieldIdsGrouped = pipe(groupByType, mapValues(groupByField))(morphOneRows);

const orWhere = [];
const orWhere: object[] = [];

for (const [type, v] of Object.entries(typeAndFieldIdsGrouped)) {
for (const [field, arr] of Object.entries(v)) {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/database/src/schema/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default (db: Database) => {
* @param {Object} index - newly generate index info
*/
const diffIndexes = (oldIndex: Index, index: Index): IndexDiff => {
const changes = [];
const changes: string[] = [];

if (!_.isEqual(oldIndex.columns, index.columns)) {
changes.push('columns');
Expand All @@ -95,7 +95,7 @@ export default (db: Database) => {
* @param {Object} foreignKey - newly generate foreignKey info
*/
const diffForeignKeys = (oldForeignKey: ForeignKey, foreignKey: ForeignKey): ForeignKeyDiff => {
const changes = [];
const changes: string[] = [];

if (_.difference(oldForeignKey.columns, foreignKey.columns).length > 0) {
changes.push('columns');
Expand Down Expand Up @@ -160,7 +160,7 @@ export default (db: Database) => {
* @param {Object} column - newly generate column info
*/
const diffColumns = (oldColumn: Column, column: Column): ColumnDiff => {
const changes = [];
const changes: string[] = [];

const isIgnoredType = ['increments'].includes(column.type);
const oldType = oldColumn.type;
Expand Down Expand Up @@ -350,7 +350,7 @@ export default (db: Database) => {
const addedTables: Table[] = [];
const updatedTables: TableDiff['diff'][] = [];
const unchangedTables: Table[] = [];
const removedTables = [];
const removedTables: Table[] = [];

for (const destTable of destSchema.tables) {
const srcTable = helpers.findTable(srcSchema, destTable.name);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"devDependencies": {
"@strapi/admin": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@strapi/types": "5.0.0-beta.3",
"@testing-library/react": "14.0.0",
"@types/koa": "2.13.4",
Expand Down
1 change: 0 additions & 1 deletion packages/core/email/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "tsconfig/base.json",
"include": ["./src", "../shared"],
"compilerOptions": {
"moduleResolution": "nodenext",
"rootDir": "../",
"baseUrl": "."
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/permissions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"sift": "16.0.1"
},
"devDependencies": {
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"eslint-config-custom": "5.0.0-beta.3",
"tsconfig": "5.0.0-beta.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/review-workflows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@strapi/admin": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@strapi/plugin-content-manager": "5.0.0-beta.3",
"@strapi/types": "5.0.0-beta.3",
"@strapi/utils": "5.0.0-beta.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const validateUpdateStageOnEntitySchema = yup
.required();

const validateContentTypes = yup.array().of(
// @ts-expect-error yup types
yup
.string()
.test({
Expand All @@ -36,7 +35,7 @@ const validateContentTypes = yup.array().of(
test(uid: any) {
// Warning; we use the strapi global - to avoid that, it would need to refactor how
// we generate validation function by using a factory with the strapi instance as parameter.
return strapi.getModel(uid);
return !!strapi.getModel(uid);
},
})
.test({
Expand Down
1 change: 0 additions & 1 deletion packages/core/review-workflows/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "tsconfig/base.json",
"include": ["src", "custom.d.ts", "../shared"],
"exclude": ["node_modules"],
"compilerOptions": {
"rootDir": "../",
"baseUrl": ".",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/strapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"@strapi/generate-new": "5.0.0-beta.3",
"@strapi/generators": "5.0.0-beta.3",
"@strapi/logger": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@strapi/permissions": "5.0.0-beta.3",
"@strapi/plugin-content-manager": "5.0.0-beta.3",
"@strapi/plugin-content-type-builder": "5.0.0-beta.3",
Expand Down Expand Up @@ -180,7 +180,6 @@
"yup": "0.32.9"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"@types/find-root": "1.1.4",
"@types/jest": "29.5.2",
"@types/lodash": "^4.14.191",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"typedoc-plugin-markdown": "3.17.1"
},
"devDependencies": {
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@strapi/ts-zen": "^0.2.0",
"@types/jest": "29.5.2",
"@types/koa": "2.13.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"devDependencies": {
"@strapi/admin": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@strapi/types": "5.0.0-beta.3",
"@testing-library/dom": "9.2.0",
"@testing-library/react": "14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/upload/server/src/services/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => {
// create temporary folder to store files for stream manipulation
const tmpWorkingDirectory = await createAndAssignTmpWorkingDirectoryToFiles(files);

let uploadedFiles = [];
let uploadedFiles: any[] = [];

try {
const { fileInfo, ...metas } = data;
Expand Down Expand Up @@ -293,7 +293,7 @@ export default ({ strapi }: { strapi: Core.Strapi }) => {
_.set(fileData, ['formats', key], file);
};

const uploadPromises = [];
const uploadPromises: Promise<void>[] = [];

// Upload image
uploadPromises.push(getService('provider').upload(fileData));
Expand Down
2 changes: 1 addition & 1 deletion packages/core/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@strapi/pack-up": "5.0.0-beta.3",
"@strapi/pack-up": "5.0.0",
"@types/koa": "2.13.4",
"@types/node": "18.19.24",
"eslint-config-custom": "5.0.0-beta.3",
Expand Down

0 comments on commit bc71a96

Please sign in to comment.